EF Core not creating migrations

The title says it all. I'm running Add-Migration on Visual Studio 2022, but I'm stuck on the output:
PM> Add-Migration Initial
Build started...
Build succeeded.
PM> Add-Migration Initial
Build started...
Build succeeded.
And there it is. No migration is created. The console get stucked on this last message and no migration file is generated. I'll attach my model and dbcontext here.
7 Replies
cypherpotato
cypherpotatoOP2w ago
https://gist.github.com/CypherPotato/51ccf17896d02a3f16da3d1c2bb07785 I'm currently on .NET 9 and EF Core 9.0.0 with Sqlite
Gist
DbConnection.cs
GitHub Gist: instantly share code, notes, and snippets.
lycian
lycian2w ago
Have you tried
dotnet ef migrations add InitialCreate
dotnet ef migrations add InitialCreate
On the project? First guess is you're active context in VS is a different project if you have multiple
cypherpotato
cypherpotatoOP2w ago
It's a solution with only one project on it
cypherpotato
cypherpotatoOP2w ago
Yea, I tried.
cypherpotato
cypherpotatoOP2w ago
Just tested in another project, it worked normally
No description
lycian
lycian2w ago
Oh that looks frozen... Idr the verbosity settings but there should be a way to set to higher for better logging
cypherpotato
cypherpotatoOP2w ago
@lycian just ran the command with -verbose flag and this was the output:
Using project 'chiyo'.
Using startup project 'chiyo'.
Build started...
Build succeeded.
C:\Program Files\dotnet\dotnet.exe exec --depsfile C:\Code\repos\chiyo\bin\Debug\net9.0\chiyo.deps.json --additionalprobingpath C:\Users\gscat\.nuget\packages --additionalprobingpath "C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages" --runtimeconfig C:\Code\repos\chiyo\bin\Debug\net9.0\chiyo.runtimeconfig.json C:\Users\gscat\.nuget\packages\microsoft.entityframeworkcore.tools\9.0.0\tools\netcoreapp2.0\any\ef.dll migrations add Initial --json --verbose --no-color --prefix-output --assembly C:\Code\repos\chiyo\bin\Debug\net9.0\chiyo.dll --project C:\Code\repos\chiyo\chiyo.csproj --startup-assembly C:\Code\repos\chiyo\bin\Debug\net9.0\chiyo.dll --startup-project C:\Code\repos\chiyo\chiyo.csproj --project-dir C:\Code\repos\chiyo\ --language C# --configuration Debug --working-dir C:\Code\repos\chiyo --root-namespace chiyo --nullable
Using assembly 'chiyo'.
Using startup assembly 'chiyo'.
Using application base 'C:\Code\repos\chiyo\bin\Debug\net9.0'.
Using working directory 'C:\Code\repos\chiyo'.
Using root namespace 'chiyo'.
Using project directory 'C:\Code\repos\chiyo\'.
Remaining arguments: .
Finding DbContext classes...
Finding IDesignTimeDbContextFactory implementations...
Finding DbContext classes in the project...
Found DbContext 'DbConnection'.
Finding application service provider in assembly 'chiyo'...
Finding Microsoft.Extensions.Hosting service provider...
Using environment 'Development'.
Using project 'chiyo'.
Using startup project 'chiyo'.
Build started...
Build succeeded.
C:\Program Files\dotnet\dotnet.exe exec --depsfile C:\Code\repos\chiyo\bin\Debug\net9.0\chiyo.deps.json --additionalprobingpath C:\Users\gscat\.nuget\packages --additionalprobingpath "C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages" --runtimeconfig C:\Code\repos\chiyo\bin\Debug\net9.0\chiyo.runtimeconfig.json C:\Users\gscat\.nuget\packages\microsoft.entityframeworkcore.tools\9.0.0\tools\netcoreapp2.0\any\ef.dll migrations add Initial --json --verbose --no-color --prefix-output --assembly C:\Code\repos\chiyo\bin\Debug\net9.0\chiyo.dll --project C:\Code\repos\chiyo\chiyo.csproj --startup-assembly C:\Code\repos\chiyo\bin\Debug\net9.0\chiyo.dll --startup-project C:\Code\repos\chiyo\chiyo.csproj --project-dir C:\Code\repos\chiyo\ --language C# --configuration Debug --working-dir C:\Code\repos\chiyo --root-namespace chiyo --nullable
Using assembly 'chiyo'.
Using startup assembly 'chiyo'.
Using application base 'C:\Code\repos\chiyo\bin\Debug\net9.0'.
Using working directory 'C:\Code\repos\chiyo'.
Using root namespace 'chiyo'.
Using project directory 'C:\Code\repos\chiyo\'.
Remaining arguments: .
Finding DbContext classes...
Finding IDesignTimeDbContextFactory implementations...
Finding DbContext classes in the project...
Found DbContext 'DbConnection'.
Finding application service provider in assembly 'chiyo'...
Finding Microsoft.Extensions.Hosting service provider...
Using environment 'Development'.
it get stuck under this last line "Using environment"... nvm i'm going to use petapoco
Want results from more Discord servers?
Add your server