![]() Writing migration to 'C:\Users\marek.ott\Desktop\demo\SampleWebApi\SampleWebApi\Migrations\20220526065812_Initial.cs'. No referenced design-time services were found.įinding IDesignTimeServices implementations in assembly 'SampleWebApi'.ĭetectChanges starting for 'SampleWebApiContext'.ĭetectChanges completed for 'SampleWebApiContext'. Using design-time services from provider ''.įinding design-time services referenced by assembly 'SampleWebApi'. Using DbContext factory 'PostgresDbContextMigrationsFactory'.įinding design-time services for provider ''. No application service provider was found.įinding DbContext classes in the project. No static method 'CreateHostBuilder(string)' was found on class 'Program'. Using project directory 'C:\Users\marek.ott\Desktop\demo\SampleWebApi\SampleWebApi\'.įinding IDesignTimeDbContextFactory implementations.įound IDesignTimeDbContextFactory implementation 'PostgresDbContextMigrationsFactory'.įinding application service provider in assembly 'SampleWebApi'.įinding service provider. Using working directory 'C:\Users\marek.ott\Desktop\demo\SampleWebApi\SampleWebApi'. Using application base 'C:\Users\marek.ott\Desktop\demo\SampleWebApi\SampleWebApi\bin\Debug\net6.0'. Writing 'C:\Users\marek.ott\Desktop\demo\SampleWebApi\SampleWebApi\obj\'.ĭotnet msbuild /target:GetEFProjectMetadata /property:EFProjectMetadataFile=C:\Users\marek.ott\AppData\Local\Temp\tmp277A.tmp /verbosity:quiet /nologo C:\Users\marek.ott\Desktop\demo\SampleWebApi\SampleWebApi\SampleWebApi.csprojĭotnet msbuild /target:GetEFProjectMetadata /property:EFProjectMetadataFile=C:\Users\marek.ott\AppData\Local\Temp\tmp2A4A.tmp /verbosity:quiet /nologo C:\Users\marek.ott\Desktop\demo\SampleWebApi\SampleWebApi\SampleWebApi.csprojĭotnet build C:\Users\marek.ott\Desktop\demo\SampleWebApi\SampleWebApi\SampleWebApi.csproj /verbosity:quiet /nologoĭotnet exec -depsfile C:\Users\marek.ott\Desktop\demo\SampleWebApi\SampleWebApi\bin\Debug\net6.0\ -additionalprobingpath C:\Users\marek.ott\.nuget\packages -runtimeconfig C:\Users\marek.ott\Desktop\demo\SampleWebApi\SampleWebApi\bin\Debug\net6.0\ C:\Users\marek.ott\.dotnet\tools\.store\dotnet-ef\6.0.5\dotnet-ef\6.0.5\tools\netcoreapp3.1\any\tools\netcoreapp2.0\any\ef.dll migrations add Initial -assembly C:\Users\marek.ott\Desktop\demo\SampleWebApi\SampleWebApi\bin\Debug\net6.0\SampleWebApi.dll -project C:\Users\marek.ott\Desktop\demo\SampleWebApi\SampleWebApi\SampleWebApi.csproj -startup-assembly C:\Users\marek.ott\Desktop\demo\SampleWebApi\SampleWebApi\bin\Debug\net6.0\SampleWebApi.dll -startup-project C:\Users\marek.ott\Desktop\demo\SampleWebApi\SampleWebApi\SampleWebApi.csproj -project-dir C:\Users\marek.ott\Desktop\demo\SampleWebApi\SampleWebApi\ -root-namespace SampleWebApi -language C# -framework net6.0 -working-dir C:\Users\marek.ott\Desktop\demo\SampleWebApi\SampleWebApi -verbose Using startup project 'C:\Users\marek.ott\Desktop\demo\SampleWebApi\SampleWebApi\SampleWebApi.csproj'. Using project 'C:\Users\marek.ott\Desktop\demo\SampleWebApi\SampleWebApi\SampleWebApi.csproj'. PS C:\Users\marek.ott\Desktop\demo\SampleWebApi\SampleWebApi> dotnet-ef migrations add Initial -v To undo this action, use 'ef migrations remove' PS C:\Users\marek.ott\Desktop\demo\SampleWebApi\SampleWebApi> dotnet-ef migrations add Initialĭone. Taking everything into consideration what is a reason for this strange behaviour? It seems like a bug, especially that it has worked previously. ![]() ![]() However, adding this method especially that it is not used and wasn't needed for 3 years seem as a lazy solution. Adding CreateHostBuilder(string args) resolves this issue, application is not started and migration is generated. After updating to EF 6 the same command starts the entire application (logs below) that needs to be killed in order to finish producing migration (which in the end is a valid one). ![]() When application had dependency on EF 5 dotnet-ef migrations add Initial -v command produced valid migration (logs below). Also, what is important, our application is implementing IDesignTimeDbContextFactory in order to control creating of DbContext when migrations are being added (find simple reproduction here: ). Instead, we provide a helper method as above. Public class Program Īs you can see it lacks CreateHostBuilder(string args) because it wouldn't be productive to add this method in all microservices.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |