Reputation: 858
I'm having an issue with my package manager console. I run Add-Migrations name -Verbose
and it hangs after finding the database context. Note - this is not my initial migration, that worked fine, this is a new migration. Also, this is a console app, not a web app, so I'm not worried about the error concerning hosting.
> PM> Add-Migration owner -Verbose
Using project 'GWMyBot.Database'.
Using startup project 'GWMyBot'.
Build started...
Build succeeded.
C:\Program Files\dotnet\dotnet.exe exec --depsfile C:\Users\parab\Source\Repos\GWMyBot\GWMyBot\bin\Debug\netcoreapp2.2\GWMyBot.deps.json --additionalprobingpath C:\Users\parab\.nuget\packages --additionalprobingpath C:\ProgramData\Xamarin\NuGet --additionalprobingpath "C:\Program Files\dotnet\sdk\NuGetFallbackFolder" --runtimeconfig C:\Users\parab\Source\Repos\GWMyBot\GWMyBot\bin\Debug\netcoreapp2.2\GWMyBot.runtimeconfig.json C:\Users\parab\.nuget\packages\microsoft.entityframeworkcore.tools\3.1.3\tools\netcoreapp2.0\any\ef.dll migrations add owner --json --verbose --no-color --prefix-output --assembly C:\Users\parab\Source\Repos\GWMyBot\GWMyBot\bin\Debug\netcoreapp2.2\GWMyBot.Database.dll --startup-assembly C:\Users\parab\Source\Repos\GWMyBot\GWMyBot\bin\Debug\netcoreapp2.2\GWMyBot.dll --project-dir C:\Users\parab\Source\Repos\GWMyBot\GWMyBot.Database\ --language C# --working-dir C:\Users\parab\Source\Repos\GWMyBot --root-namespace GWMyBot.Database
Using assembly 'GWMyBot.Database'.
Using startup assembly 'GWMyBot'.
Using application base 'C:\Users\parab\Source\Repos\GWMyBot\GWMyBot\bin\Debug\netcoreapp2.2'.
Using working directory 'C:\Users\parab\Source\Repos\GWMyBot\GWMyBot'.
Using root namespace 'GWMyBot.Database'.
Using project directory 'C:\Users\parab\Source\Repos\GWMyBot\GWMyBot.Database\'.
Finding DbContext classes...
Finding IDesignTimeDbContextFactory implementations...
Finding application service provider...
Finding Microsoft.Extensions.Hosting service provider...
No static method 'CreateHostBuilder(string[])' was found on class 'Program'.
No application service provider was found.
Finding DbContext classes in the project...
Found DbContext 'MyContext'.
Using context 'MyContext'.
I've let this just sit for nearly an hour, nothing happens.
Upvotes: 0
Views: 2351
Reputation: 11
I had the same issue when trying to add a migration after changing the base class from DbContext
to IdentityDbContext
.
It was due to a mismatch in the references for Microsoft.AspNetCore.Identity.EntityFrameworkCore
.
Project was on .Net Core 5 prev 7 but I mistakenly added a reference in NuGet for 3.1.
Upvotes: 1