# How to import a NET .dll newer than 2.0 into Unity?

I'm trying to build one of the simple EventBus libraries from Github and import them into Unity. Here are the libs:

It's that simple - I take the source code, build it through the VS2015 and place the .dll into the Assets/Plugins folder.

Then, I have no way to use the lib's namespace (Unity doesn't read the file).

Both of these libraries are written in NET 3 or 4 and this is the failure's reason. I've recompiled the second one (removed the System.Linq code, changed the project's version) to NET 2.0 and it worked, but that's not the point. I need the first library and it ain't easy to rewrite the entire 4.0 code to 2.0 without Linq.

As I remember, you can use System.Linq in Unity (at least, I did it once). This means that Unity uses some kind of trickery/magic, as always.

What's the problem here? Is there any way to get this working?

• It should be possible instruct VS compiler to output for older versions of .NET. How to do that exactly I am not sure, but can give you a lead - the C# 6 project which did that for Unity projects. Adapting the solution for generic libraries should be possible as well. – wondra Aug 10 '17 at 16:51
• Yes, it is possible through project settings. But the project is coded for a NET > 2 it uses Linq everywhere. – Jacob Aug 10 '17 at 16:52
• Well... it is exactly what the linked project does - allow you using the C# 6 features throughout the project and then compile it into .NET 2.0 compatible CLR The problem I see is if the said libraries depend on other libraries that could not be loaded. "Microsoft and Mono compilers can compile C# 5/6/7 code for CLR 2.0 if you explicitly ask them to do so." explicitly stated in second sentence of the projects description. – wondra Aug 10 '17 at 16:55