How to include MEF in Unity 2020 LTS ? (resolved)

I tried to include MEF library in Unity 2020 LTS

My project settings

Scripting Backend: Mono

Api Compatibility Level: .Net Standard 2.0

Here are my steps to try and include an external library:

  1. nupkg has been loaded from
  2. Then i got the system.componentmodel.composition.5.0.0.nupkg
  3. And when i unpacked .nupkg file i got netstandard2.0/System.ComponentModel.Composition.dll
  4. Then i added System.ComponentModel.Composition.dll to Assets folder
  5. Then i got this error messages in console:

Error: Could not load signature of System.ComponentModel.Composition.Hosting.CompositionContainer:ReleaseExports due to: Could not resolve type with token 0100003c (from typeref, class/assembly System.Lazy2, netstandard, Version=, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51) assembly:netstandard, Version=, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51 type:System.Lazy2 member:(null) signature:

Search for information

Some people say to create mcs.rsp file, which is now called scs.rsp as far as I understand.

And inside the file you have to add this line, it is only valid for ** mcs.rsp **:


And for the file ** scs.rsp ** it should be correct:


But I found Unity3d Manual page Referencing additional class library assemblies

And the following was written inside:

If your Project uses the .NET Standard

2.0 API Compatibility Level, you don’t need to take any additional steps to

use part of the .NET class library

Does this mean that I do not need to perform any additional steps in order for the library to start working?

It would be great if someone could help with this issue.

I have already tried the following points, but nothing works:

  • different versions of Unity (2018 LTS, 2019 LTS)

  • different versions of Api Compatibility Level (.Net 4.0)

  • creating scs.rsp file

  • creating mcs.rsp file

I was able to make the library work.

I was looking for a solution for a long time, came across the fact that this library is contained in .NET 4.x and I had to figure out how to import library it better, and I found a very simple solution it is take the library from the Unity folder and drop it into the Assets folder

Steps to import .dll

  1. I took the System.ComponentModel.Composition.dll library along the following path
    C:\Program Files\Unity\Hub\Editor\2020.3.2f1\Editor\Data\MonoBleedingEdge\lib\mono\unityjit
  2. Then I changed the Api Compatibility Level from .NET Standard 2.0 to .NET 4.x
  3. Voila everything works.

If it was helpful, please like it :wink: