HoloLens fix – Visual Studio 2017 build error

I’ve been using the latest Unity 4.6.1f1 to build HoloLens apps for Visual Studio 2017. After exporting to VS17, though, I run into the following error trying to compile my app.

1>—— Build started: Project: Assembly-CSharp-firstpass, Configuration: Debug x86 ——

1>CSC : warning CS8021: No value for RuntimeMetadataVersion found. No assembly containing System.Object was found nor was a value for RuntimeMetadataVersion specified through options.

1>  Running SerializationWeaver…

1>  System.Exception: project.lock.json file at D:\Documents\Unity\testnuget\WindowsStoreApp\GeneratedProjects\UWP\Assembly-CSharp-firstpass\project.lock.json does not exist!

1>     at usw.Program.CheckLockJsonFile(String lockJsonFile)

1>     at usw.Program.RunProgram(ConversionOptions options)

1>     at usw.Program.Main(String[] args)

1>D:\Documents\Unity\testnuget\WindowsStoreApp\GeneratedProjects\UWP\Assembly-CSharp-firstpass\Assembly-CSharp-firstpass.csproj(184,5): error MSB3073: The command “”D:\Documents\Unity\testnuget\WindowsStoreApp\Unity\Tools\SerializationWeaver\SerializationWeaver.exe” “D:\Documents\Unity\testnuget\WindowsStoreApp\GeneratedProjects\UWP\Assembly-CSharp-firstpass\bin\x86\Debug\Unprocessed\Assembly-CSharp-firstpass.dll” “-pdb” “-verbose” “-unity-engine=D:\Documents\Unity\testnuget\WindowsStoreApp\testnuget\Unprocessed\UnityEngine.dll” “D:\Documents\Unity\testnuget\WindowsStoreApp\GeneratedProjects\UWP\Assembly-CSharp-firstpass\obj\x86\Debug\x86\Debug” “-lock=D:\Documents\Unity\testnuget\WindowsStoreApp\GeneratedProjects\UWP\Assembly-CSharp-firstpass\project.lock.json” “@D:\Documents\Unity\testnuget\WindowsStoreApp\GeneratedProjects\UWP\Assembly-CSharp-firstpass\SerializationWeaverArgs.txt” “-additionalAssemblyPath=D:\Documents\Unity\testnuget\WindowsStoreApp\testnuget\Unprocessed” “-unity-networking=D:\Documents\Unity\testnuget\WindowsStoreApp\testnuget\Unprocessed\UnityEngine.Networking.dll”” exited with code 1.

2>—— Build started: Project: Assembly-CSharp, Configuration: Debug x86 ——

2>CSC : error CS0006: Metadata file ‘D:\Documents\Unity\testnuget\WindowsStoreApp\GeneratedProjects\UWP\Assembly-CSharp-firstpass\bin\x86\Debug\Assembly-CSharp-firstpass.dll’ could not be found

3>—— Build started: Project: testnuget, Configuration: Debug x86 ——

3>CSC : error CS0006: Metadata file ‘D:\Documents\Unity\testnuget\WindowsStoreApp\GeneratedProjects\UWP\Assembly-CSharp-firstpass\bin\x86\Debug\Assembly-CSharp-firstpass.dll’ could not be found

3>CSC : error CS0006: Metadata file ‘D:\Documents\Unity\testnuget\WindowsStoreApp\GeneratedProjects\UWP\Assembly-CSharp\bin\x86\Debug\Assembly-CSharp.dll’ could not be found

And the VS error window looks like this:

error

It’s actually a dumb problem, but since I’ve been struggling with it for days, I’m hoping blogging about it will save you a few hours of head banging.

The best clue to what’s going on is the reference to the missing project.lock.json file. This is a nuGet file and somewhere in the HoloLens documentation it mentions that a HoloLens app built with Unity requires some nuget files in order to work.

nuget

In Visual Studio I went to Tools | Options | NuGet Package Manager and discovered that I had NuGet configured incorrectly in my shiny new VS install. I’m not totally sure why. By not allowing NuGet packages to be automatically downloaded, my HoloLens app was missing required files.

fix

Both Allow NuGet to download missing packages and Automatically check for missing packages should have been selected.

After that, HoloLens builds have been working for me and I have been able to start deploying apps again.

Leave a Reply

Your email address will not be published. Required fields are marked *