-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Scaffold-DBContext fails when Database connection string is moved to secrets.json in efcore 9.0.1 and 9.0.2 #35641
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Microsoft.EntityrameworkCore.Tools from 9.0.0 to 9.0.1 or 9.0.2 give to me same problem.
|
Could you add |
9.0.0 with -Verbose
|
9.0.1 with -Verbose
|
Scaffold-DbContext Name=ConnectionStrings:AzureConnection Microsoft.EntityFrameWorkCore.SqlServer -outputdir Models -context AssetCareDbContext -contextdir Repository -DataAnnotations -Force |
With Microsoft.EntityFrameworkCore.Tools 9.0.2 PM> Scaffold-DbContext Name=ConnectionStrings:AzureConnection Microsoft.EntityFrameWorkCore.SqlServer -outputdir Models -context AssetCareDbContext -contextdir Repository -DataAnnotations -Force -Verbose |
With Microsoft.EntityFrameworkCore.Tools 9.0.0 PM> Scaffold-DbContext Name=ConnectionStrings:AzureConnection Microsoft.EntityFrameWorkCore.SqlServer -outputdir Models -context AssetCareDbContext -contextdir Repository -DataAnnotations -Force -Verbose |
I see. The As a workaround, set |
@AndriySvyryd thank you for the workaround. I can confirm this fixes the issue. Will this be resolved in a future edition? |
Yes, will fix it soon. |
@AndriySvyryd I can also confirm this fixes the issue. Honestly, thank you very much, this speed of response is not usually common nowadays. |
Excellent! Thank you for your help.
…________________________________
From: Andriy Svyryd ***@***.***>
Sent: Tuesday, February 25, 2025 9:01 PM
To: dotnet/efcore ***@***.***>
Cc: ruhar ***@***.***>; Author ***@***.***>
Subject: Re: [dotnet/efcore] Scaffold-DBContext fails when Database connection string is moved to secrets.json in efcore 9.0.1 and 9.0.2 (Issue #35641)
Will this be resolved in a future edition?
Yes, will fix it soon.
—
Reply to this email directly, view it on GitHub<#35641 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AAFPKL5THFOEPCW3FY4NZRT2RUVA3AVCNFSM6AAAAABXHDEHGGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMOBTG43TEOBYGQ>.
You are receiving this because you authored the thread.Message ID: ***@***.***>
[AndriySvyryd]AndriySvyryd left a comment (dotnet/efcore#35641)<#35641 (comment)>
Will this be resolved in a future edition?
Yes, will fix it soon.
—
Reply to this email directly, view it on GitHub<#35641 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AAFPKL5THFOEPCW3FY4NZRT2RUVA3AVCNFSM6AAAAABXHDEHGGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMOBTG43TEOBYGQ>.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
I can confirm 9.0.3 Still need to execute "$env:ASPNETCORE_ENVIRONMENT = 'Development'" in order to execute scaffold correctly. |
Bug description
Scaffold-DBContext works when database connection is setup in appsettings.json in all versions tested. 8.0.8-9.0.2. When moving the database connection to secrets.json, the Scaffold-DBContext command works as expected in versions 8.0.8-9.0.0. I receive a Database Connection was not found in the applications configuration error in versions 9.0.1 and 9.0.2. Rolling the Microsoft.EntityFrameworkCore.SqlServer and Microsoft.EntityrameworkCore.Tools back to version9.0.0 or earlier, Scaffold-DBContext command works using secrets.json.
Your code
Stack traces
Verbose output
EF Core version
9.0.2
Database provider
No response
Target framework
.NET 8.0
Operating system
Windows 11
IDE
Visual Studio 2022 v17.4
The text was updated successfully, but these errors were encountered: