I upgraded a .net standard class library from Entity Framework Core 1.1 to Entity Framework 2.0
I am trying to run Add-Migration on an Entity Framework Core Class Li
I had the same problem, and it got fixed after installing .NET 4.7.1 framework
Add AutoGenerateBindingRedirects
and GenerateBindingRedirectsOutputType
to your class library csproj
e.g.
<PropertyGroup>
<TargetFramework>net461</TargetFramework>
....
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType>
</PropertyGroup>
Starting with the following lovely error because StructureMap failed to instantiate the dbContext for Entity Framework Core:
An error occurred when trying to create a controller of type '[NameOfController]'. Make sure that the controller has a parameterless public constructor.
I had to do some more work than the answers supplied here to get it to work in .NET Framework 4.6.2:
Install nugets (source: https://github.com/neuecc/MessagePack-CSharp/issues/46)
Add to .proj that contained repositories (source: https://stackoverflow.com/a/45978409/581414)
<PropertyGroup>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType>
</PropertyGroup>
And to web.config (sources: various)
<configuration>
...
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
...
<dependentAssembly>
<assemblyIdentity name="System.ValueTuple" publicKeyToken="cc7b13ffcd2ffffd51" />
<bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
...
</configuration>