- Home /
.NET Standard 2.0 reference not recognised
Hey all,
I am currently experimenting with the Hololens in combination with Unity. Part of the experiment is exchanging data with an existing .NET Framework application. This means that I have a number of libraries that are shared by both applications, which I have rewritten into .NET Standard 2.0 libraries so that they are compatible with both applications.
However, when I start referencing the .NET Standard 2.0 library in a Unity script, Unity gives the following error:
error CS0012: The type 'Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'netstandard, Version=2.0.0.0, Culture=neutral'.
I am having a lot of trouble figuring out what is causing this. When I check Edit -> Project Settings -> Player, I have Scripting Runtime Version set to .NET 4.x Equivalent; Scripting Backend to .NET; and Api Compatibility Level to .NET Standard 2.0. When I double click the error, it opens the Assembly-CSharp assembly in Visual Studio, where it shows netstandard among its references. When I lower the target of the libraries to .NET Standard 1.4, I no longer have the error, but unfortunately I have to use 2.0.
What do I need to set in order for Unity to recognise that netstandard is referenced?
I use Unity 2018.1.6f.
Thanks for reading.