Legends Legends - 2 months ago 54
C# Question

A reference to could not be added ´. An assembly must have a dll or exe extension in order to be refrerenced

I have plain c# console application (.NET 4.6) which I want to reference .NET Core Class Library:

{
"version": "1.0.0-*",

"dependencies": {
"NETStandard.Library": "1.6.0",
"Newtonsoft.Json": "9.0.1"
},

"frameworks": {
"netstandard1.4": {
"imports": "dnxcore50"
}
}
}


And I get the following exception:

enter image description here

Answer

Simple solution:

My .NET console application uses .NET 4.6 and should reference a Core Class Library using .NET Platform Standard 1.4.

Mapping the .NET Platform Standard to platforms says that .NET 4.6 is compatible with .NET Platform Standard 1.3.

Changing the project.json of the Core Class Library to (excerpt)

"frameworks": {
    "netstandard1.3": {
      "imports": "dnxcore50"
    }
  }

solved the problem.

Comments