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.

14 thoughts on “HoloLens fix – Visual Studio 2017 build error

  1. This help not work on VS 2017
    Microsoft Visual Studio Professional 2017
    Version 15.3.1
    VisualStudio.15.Release/15.3.1+26730.8
    Microsoft .NET Framework
    Version 4.7.02046

    Installed Version: Professional

    1. Same issue here. I’m getting the pathing error, the section where command ended after line 1.

  2. hi James,
    In my project, both ‘Allow NuGet to download missing packages’ and ‘Automatically check for missing packages’ have been selected. However, the problem still occurs.
    My visual studio community 2017’s version is 15.3.2.
    Unity 2017.1.0f3
    Could you give me some advice on this problem? thanks!
    Edison

    1. Long path names can also cause an error like this. Try moving your unity project to a root folder and see what happens.

  3. I had the same problem and resolved it using Unity 5.6.3p2
    (didn’t work on 5.6.3p1). Then in Visual Studio 2017 (15.3.3) I cheked as stated here, “Allow NuGet to download missing packages and Automatically check for missing packages” (I also checked the package management allow format…)
    Then it finally worked

  4. You are so right!!! this was the problem i was having – path/file name too long. Thanks for your help.

Comments are closed.