Interop Between .Net Core and .Net Framework 4.x.x


Is there currently a way to reference/PInvoke an existing .Net Framework 4.x.x (or Mono) assembly from a .Net Core application?

If not, is such a thing planned?

The only solution that I think might be feasible is to use Unmanaged Exports, but I haven’t tried it yet and would prefer to avoid it. Also, I eventually want to be able to use it on an ARM Linux machine, and I’m not sure if Unmanaged Exports were intended for use on that platform.

I tried adding a project reference from a .Net Framework 4.6.x project to a .Net Core 1.1 project in the same Visual Studio 2017 solution, but, while Visual Studio allowed me to add the reference, it resulted in the following compiler error:

error CS0012: The type ‘Object’ is defined in an assembly that is not referenced. You must add a reference to assembly ‘mscorlib, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089’.

I also tried using a portable class library and a .Net Standard class library as a bridge between the two, but neither one can seem to interop with the .Net Framework class library.

Anyone have any clever ideas?


I believe that this will be possible with .Net Core 2.0 (which will use .Net Standard 2.0). From Introducing .NET Standard:

.NET Standard 2.0 includes a compatibility shim for .NET Framework binaries, significantly increasing the set of libraries that you can reference from your .NET Standard libraries.

.NET Foundation Website | Blog | Projects | Code of Conduct