I have installed Unity 2018.1.0f2. I created a simple project that displays a cube for the HoloLens. Then when I try to build the project in Visual Studio 2017 I get the following errors in the file App.cs.
Error CS0012 The type 'CoreApplicationView' is defined in an assembly that is not referenced. You must add a reference to assembly 'Windows, Version=255.255.255.255, Culture=neutral, PublicKeyToken=null, ContentType=WindowsRuntime'. PKproject3 C:\\Users\\Puran Kansakar\\Documents\\PKproject3\\App\\PKproject3\\App.cs 34 Active
Error CS0012 The type 'CoreWindow' is defined in an assembly that is not referenced. You must add a reference to assembly 'Windows, Version=255.255.255.255, Culture=neutral, PublicKeyToken=null, ContentType=WindowsRuntime'. PKproject3 C:\\Users\\Puran Kansakar\\Documents\\PKproject3\\App\\PKproject3\\App.cs 58 Active
How do I solve it?
Puran
使用Unity而不是Visual Studio 2017构建项目。
Clean the project and rebuild it and hit start (blue play button). This might solve your problem.
Here, try following this workflow:
If that doesn't work in your Unity version, try a different Unity version. 5.5.x is stable for HoloLens, and I've had luck with the newest ones, such as 2018.2. I have never had luck working with IL2CPP over .NET personally, always led to compiler errors for me.
When you say you are building the project in VS are you first building the project in Unity and then opening the VS Solution file that is created and then building that? You also have to pay close attention to the .NET versions and scripting backend in your build settings as this affects what assemblies are referenced. I would recommend using IL2CPP instead of the .NET scripting backend since the .NET scripting backend is being deprecated. I would also recommend using the highest version of the Scripting runtime version and API compatibility release if you are starting a new project.
Edit: Definitely try the IL2CPP option I described as this gives you the highest .NET surface availalbe.
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.