2

I want to reference a dotNet Core project to a WPF project.

My WPF project is using the v4.6.2 dotNet Framework and my dotNet Core project is using the v1.6 dotNet Standard.

When I try to reference it, I get this error:

A reference to 'ClassLibrary' could not be added. An assembly must have a 'dll' or 'exe' extension in order to be referenced.

kenorb
  • 155,785
  • 88
  • 678
  • 743
Fufa2000
  • 51
  • 2
  • Why not create a .net standard library? That would be able to be referenced by .NET Framework and .NET Core applications. – myermian Feb 11 '18 at 20:36

2 Answers2

2

v1.6 .Net Core isn't compatible with v4.6.2 .Net according to the docs.

So I changed it to v1.5 .Net Core.

Fufa2000
  • 51
  • 2
0

I found this YouTube video. The easiest way is to write this in the *.csproj

<TargetFrameworks>netcoreapp2.0;net462</TargetFrameworks>

instead of this

<TargetFramework>netcoreapp2.0</TargetFramework>

Important notes: don't forget the extra s in targetframeworkS. You should at least have Runtime and DevPack of .NET Core 4.6.2.(get it here). After the change you often have to right click unload and then right click reload the project.

CodingYourLife
  • 7,172
  • 5
  • 55
  • 69
  • Go with netstandard if you are building a libraries so that they can be used in dotnet core as well as dot net framework. Sharing a link with full compatibility chart https://learn.microsoft.com/en-us/dotnet/standard/net-standard – Sachin Jain Oct 17 '19 at 02:52