Hololens Build Failing - The command AssemblyConve

2020-04-08 01:30发布

问题:

After updating to the latest version of VS 2017 (version 15.3.2) my Hololens builds generated from Unity keep failing with this message :

The command ""C:\TestFile\HoloBuild\VSApp\Unity\Tools\AssemblyConverter.exe" -platform=uap -lock="C:\TestFile\HoloBuild\VSApp\HoloBuild\project.lock.json" -bits=32 -configuration=Debug -removeDebuggableAttribute=False -uwpsdk=10.0.15063.0 -path="." -path="C:\Program Files\Unity\Editor\Data\PlaybackEngines\MetroSupport\Players\UAP\dotnet\x86\Debug" "C:\TestFile\HoloBuild\VSApp\HoloBuild\Assembly-CSharp.dll" "C:\TestFile\HoloBuild\VSApp\HoloBuild\UnityEngine.dll" "C:\TestFile\HoloBuild\VSApp\HoloBuild\UnityEngine.Analytics.dll" "C:\TestFile\HoloBuild\VSApp\HoloBuild\nunit.framework.dll" "C:\TestFile\HoloBuild\VSApp\HoloBuild\UnityEngine.UI.dll" "C:\TestFile\HoloBuild\VSApp\HoloBuild\UnityEngine.HoloLens.dll" "C:\TestFile\HoloBuild\VSApp\HoloBuild\UnityEngine.Networking.dll" "C:\TestFile\HoloBuild\VSApp\HoloBuild\UnityEngine.VR.dll"" exited with code 1. HoloBuild C:\TestFile\HoloBuild\VSApp\HoloBuild\HoloBuild.csproj 292

I have this error in the build output :

1> System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary. (TaskId:275)

1> at System.Collections.Generic.Dictionary`2.get_Item(TKey key) (TaskId:275)

1> at UnityEditor.Scripting.Compilers.NuGetPackageResolver.Resolve() (TaskId:275)

1> at Unity.UWPAssemblyResolver..ctor(String projectLockFile, String desiredUWPSDKVersion) (TaskId:275)

1> at Unity.OperationContext.SetPlatform(Platform platform, String projectLockFile, String uwpSDK) (TaskId:275)

1> at Unity.ParseArgsStep.Execute() (TaskId:275)

1> at Unity.Step.Execute(OperationContext operationContext, IStepContext previousStepContext) (TaskId:275)

1> at Unity.Operation.Execute() (TaskId:275)

1> at Unity.Program.Main(String[] args) (TaskId:275)

I have tried with many fresh projects but the result is the same with the same error message.

As suggested in some threads, I tried removing and adding back some references, tried messing with some build settings in Unity.

I'm not sure at all that this issue is because of updating Visual Studio. Has anyone faced the same issue ? How may I be able to build my projects ?

回答1:

This problem is related to a bug in Unity that makes it not work with Visual Studio 2017 (15.3). Here are some links regarding it. I believe you can install a Unity patch, but the easiest solution I found was to downgrade Visual Studio to the 2015 version. If you have access to Visual Studio 2017 (15.2) that would work as well.

Here are the related links:

  1. https://forum.unity3d.com/threads/net-scripting-backend-and-visual-studio-2017-3-incompatibility.487833/

  2. https://forum.unity3d.com/threads/build-error-assembly-csharp-dll-could-not-be-found-hololens.458493/

Hope this helps!



回答2:

I am facing the same problem and unable to resolve since 3 days, i have used Unity 5.6.1f1, Unity 5.6.2f1, Unity 2017.1.0f3 and Unity 2017.1.0p3 and the new Unity 2017.2.0b10 (64-bit). I have removed and rebuilt the .sln file multiple times, even created multiple projects from scratch. The issue persists.

I have looked at threads / solutions here, and other forums and tried those but the issue is still there. 1 thing is for sure that i am not doing correct settings or something is very wrong, because I have reinstalled Unity, Visual Studio.

Finally it worked with VS 2015 SP3 and Windows SDK 10.0.14393 https://forum.unity3d.com/threads/build-error-assembly-csharp-firstpass-dll-could-not-be-found-hololens.488357/