You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are some discussion (e.g., #398) about how to run migrations. However, I ran into the issue in creating migrations. It's working as long as I use something like this builder.AddNpgsqlDbContext<ApplicationDbContext>(ServiceNames.DATABASE_EMPLS.NAME). When I add builder.AddNpgsqlDataSource(ServiceNames.DATABASE_EMPLS.NAME) I get the following error with the command dotnet ef migrations add update -p ..\AspireApp.Data.Postgres\
Unable to create a 'DbContext' of type ''. The exception 'ConnectionString is missing. It should be provided in 'ConnectionStrings:employee-db' or under the 'ConnectionString' key in 'Aspire:Npgsql' configuration section.' was thrown while attempting to create an instance. For the different patterns supported at design time, see https://go.microsoft.com/fwlink/?linkid=851728
Unable to create a 'DbContext' of type ''. The exception 'ConnectionString is missing. It should be provided in 'ConnectionStrings:employee-db' or under the 'ConnectionString' key in 'Aspire:Npgsql' configuration section.' was thrown while attempting to create an instance. For the different patterns supported at design time, see https://go.microsoft.com/fwlink/?linkid=851728
Is there an existing issue for this?
Describe the bug
There are some discussion (e.g., #398) about how to run migrations. However, I ran into the issue in creating migrations. It's working as long as I use something like this
builder.AddNpgsqlDbContext<ApplicationDbContext>(ServiceNames.DATABASE_EMPLS.NAME)
. When I addbuilder.AddNpgsqlDataSource(ServiceNames.DATABASE_EMPLS.NAME)
I get the following error with the commanddotnet ef migrations add update -p ..\AspireApp.Data.Postgres\
Full example: https://github.com/fkamp/aspire-ef-migration-issue
Can someone give me a pointer if that's my incompetency or if it's a bug.
Thanks!
Expected Behavior
After issuing
dotnet ef migrations add update -p ..\AspireApp.Data.Postgres\
migrations are added to the project without any error.Steps To Reproduce
Clone and run https://github.com/fkamp/aspire-ef-migration-issue
Exceptions (if any)
Unable to create a 'DbContext' of type ''. The exception 'ConnectionString is missing. It should be provided in 'ConnectionStrings:employee-db' or under the 'ConnectionString' key in 'Aspire:Npgsql' configuration section.' was thrown while attempting to create an instance. For the different patterns supported at design time, see https://go.microsoft.com/fwlink/?linkid=851728
.NET Version info
.NET SDK:
Version: 8.0.400
Commit: 36fe6dda56
Workload version: 8.0.400-manifests.f51a3a6b
MSBuild version: 17.11.3+0c8610977
Runtime Environment:
OS Name: Windows
OS Version: 10.0.26100
OS Platform: Windows
RID: win-x64
Base Path: C:\Program Files\dotnet\sdk\8.0.400\
.NET workloads installed:
Configured to use loose manifests when installing new manifests.
[aspire]
Installation Source: SDK 8.0.400, VS 17.11.35303.130
Manifest Version: 8.2.0/8.0.100
Manifest Path: C:\Program Files\dotnet\sdk-manifests\8.0.100\microsoft.net.sdk.aspire\8.2.0\WorkloadManifest.json
Install Type: FileBased
Host:
Version: 8.0.8
Architecture: x64
Commit: 08338fcaa5
.NET SDKs installed:
8.0.400 [C:\Program Files\dotnet\sdk]
.NET runtimes installed:
Microsoft.AspNetCore.App 6.0.33 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 7.0.20 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 8.0.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 6.0.33 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 7.0.20 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 8.0.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 6.0.33 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 7.0.20 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 8.0.8 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Other architectures found:
x86 [C:\Program Files (x86)\dotnet]
registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation]
Environment variables:
Not set
Anything else?
No response
The text was updated successfully, but these errors were encountered: