Hi everyone,
I’ve just updated to .net core 3.0 and have been hitting a few issues. I hit this one while trying to add a migration:
Adding -verbose to this allowed me to narrow the cause down a little further:
Using project ‘PropertyApi’.
Using startup project ‘PropertyApi’.
Build started…
Build succeeded.
C:\Program Files\dotnet\dotnet.exe exec –depsfile C:\Users\Celeste\Documents\repos\property-api\PropertyApi\bin\Debug\netcoreapp3.0\PropertyApi.deps.json –additionalprobingpath C:\Users\Celeste\.nuget\packages –additionalprobingpath “C:\Program Files\dotnet\sdk\NuGetFallbackFolder” –runtimeconfig C:\Users\Celeste\Documents\repos\property-api\PropertyApi\bin\Debug\netcoreapp3.0\PropertyApi.runtimeconfig.json C:\Users\Celeste\.nuget\packages\microsoft.entityframeworkcore.tools\3.0.0\tools\netcoreapp2.0\any\ef.dll migrations add add-propertyid-to-entities-for-events –json –verbose –no-color –prefix-output –assembly C:\Users\Celeste\Documents\repos\property-api\PropertyApi\bin\Debug\netcoreapp3.0\PropertyApi.dll –startup-assembly C:\Users\Celeste\Documents\repos\property-api\PropertyApi\bin\Debug\netcoreapp3.0\PropertyApi.dll –project-dir C:\Users\Celeste\Documents\repos\property-api\PropertyApi\ –language C# –working-dir C:\Users\Celeste\Documents\repos\property-api –root-namespace PropertyApi
Using assembly ‘PropertyApi’.
Using startup assembly ‘PropertyApi’.
Using application base ‘C:\Users\Celeste\Documents\repos\property-api\PropertyApi\bin\Debug\netcoreapp3.0’.
Using working directory ‘C:\Users\Celeste\Documents\repos\property-api\PropertyApi’.
Using root namespace ‘PropertyApi’.
Using project directory ‘C:\Users\Celeste\Documents\repos\property-api\PropertyApi\’.
Finding DbContext classes…
Finding IDesignTimeDbContextFactory implementations…
Finding application service provider…
Finding Microsoft.Extensions.Hosting service provider…
Using environment ‘Development’.
System.ArgumentNullException: Value cannot be null. (Parameter ‘implementationInstance’)
The key part here are the fact that it can’t find the config values and that it’s attempting to use the ‘Development’ env whereas it should be looking for ‘Local’.
It seems that during the upgrade all of my environment variables have been wiped. All that was required was to run the following (change local to match your environment):
Running the add-migration command should now user the local configuration. Thanks to the following link for the solution:
https://stackoverflow.com/a/50507486/522859
Leave a Reply