I made an UWP application in Unity for Hololens and I added in the Assets a class using Tasks (System.Threading.Tasks). The code of the class is surrounded by the compilation directive as follow:
#if WINDOWS_UWP
.... Code Here
#endif
since it needs to work only on the device.
I successfully deployed the application on the Hololens.
But when I try to move the class in an external dll, generated compiling a Class Library (Universal Windows) project in Visual studio, and I reference it in Unity, when compiling I get the following error:
... type 'Task<>' claims it is defined in 'System.Runtime', but it could not be found.
It seems that it is not using System.Threading.Tasks, but it tries to use a Task class defined in System.Runtime.
Why this happens only if the class is in an external dll and I works when the class is directly in the assets folder?
Since I need to have the code in the external dll how can I fix it?
The problem was in the minimun SDK version of the UWP library.
By default Unity uses Windows 10 (10.0; Build 10240) when building UWP applications, while the minimum version of the UWP Library was Windows 10 Creators Update (10.0; Build 15063) .
Setting up the SDK minimum version of the UWP Class library in visual studio to Windows 10 (10.0; Build 10240) , and reimporting the dll in Unity, solved my problem.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.