Error during compilation with .NET 4.6.1 on a Nuget Class Library with EF core

.net-4.6 .net-core c# entity-framework-core visual-studio-2015

Question

I have a problem during compilation for two .NET class libraries. the problem occur during build targeting .NET4.6.1 (or 4.5.2, 4.6 or other, I've try all).

.NET Framework 4.6 error CS0012: The type 'Func<,>' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'

I had add the dependecy on my project.json :

"dependencies": {
  "BusinessCore": "1.0.0-*",
  "EntityFramework.Core": "7.0.0-rc1-final",
  "System.Runtime": "4.0.21-beta-23516"
}

But it doesn't change anything. Trying to add as reference by looking after the dll on my system drive doesn't change anything too. Anyone have ever had this issue ?

1
2
2/10/2016 4:06:19 PM

Accepted Answer

I finaly found a solution, I add

"frameworkAssemblies": {
    "System.Runtime": ""
  }

Under my net451 of frameworks. Then System.Runtime is imported by the Net Framework, no more compilation problem.

2
2/18/2016 3:53:03 PM

Popular Answer

I think you should add the .dll as 'Add Reference' to your project in VS. It should work fine.

Right click on your project in VS and 'Add Reference'. Did you try it?



Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow