efcore: Migrations looking for invalid netstandard version after update to EF 3.0
Recently updated asp.net core project to netcoreapp 3.0 and updated Microsoft.EntityFramework.* to 3.0.0
Everything is working as expected, all tests are passing and production instances are all stable… however.
Any dotnet ef * command produces the following output
System.IO.FileLoadException: Could not load file or assembly 'netstandard, Version=2.1.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
File name: 'netstandard, Version=2.1.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'
at System.Reflection.RuntimeAssembly.GetType(RuntimeAssembly assembly, String name, Boolean throwOnError, Boolean ignoreCase, ObjectHandleOnStack type, ObjectHandleOnStack keepAlive)
at System.Reflection.RuntimeAssembly.GetType(String name, Boolean throwOnError, Boolean ignoreCase)
at Microsoft.EntityFrameworkCore.Tools.ReflectionOperationExecutor..ctor(String assembly, String startupAssembly, String projectDir, String dataDirectory, String rootNamespace, String language)
at Microsoft.EntityFrameworkCore.Tools.Commands.ProjectCommandBase.CreateExecutor()
at Microsoft.EntityFrameworkCore.Tools.Commands.DatabaseUpdateCommand.Execute()
at Microsoft.DotNet.Cli.CommandLine.CommandLineApplication.Execute(String[] args)
at Microsoft.EntityFrameworkCore.Tools.Program.Main(String[] args)
Could not load file or assembly 'netstandard, Version=2.1.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
I have no global.json anywhere in my tree, I have dotnet-sdk 3.0, 2.2 & 2.1 intalled. I have audited my dependencies as much as I can (this is a large multi-project solution with a large number of dependencies) to ensure they are all up to date (dotnet outdated shows clean, NuGet package manager in VS shows no updates). I’m filing this as a bug as I have put close to 10 hours into this now and I’m out of ideas, I’m happy to accept that there is something wrong in my dependency graph but this really shouldn’t be this hard? Especially given that I’m not running any preview packages, everything is RTM.
Further technical details
(showing output from my Ubuntu box, behaviour is exactly the same on my Windows box)
dotnet --info
.NET Core SDK (reflecting any global.json):
Version: 3.0.100
Commit: 04339c3a26
Runtime Environment:
OS Name: ubuntu
OS Version: 19.10
OS Platform: Linux
RID: ubuntu.19.10-x64
Base Path: /usr/share/dotnet/sdk/3.0.100/
Host (useful for support):
Version: 3.0.0
Commit: 95a0a61858
.NET Core SDKs installed:
2.1.802 [/usr/share/dotnet/sdk]
2.2.402 [/usr/share/dotnet/sdk]
3.0.100 [/usr/share/dotnet/sdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.1.13 [/usr/share/dotnet/shared/Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.2.7 [/usr/share/dotnet/shared/Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.13 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.2.7 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 3.0.0 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.1.13 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 2.2.7 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 3.0.0 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 1
- Comments: 19 (8 by maintainers)
Thanks for getting involved @ajcvickers and @bricelam, I tried to put together a minimal repro over the weekend, and along the way discovered the issue was that I now need the below in the csproj file of the project which contains my migrations.