microsoft / MixedRealityToolkit-Unity

This repository is for the legacy Mixed Reality Toolkit (MRTK) v2. For the latest version of the MRTK please visit https://github.com/MixedRealityToolkit/MixedRealityToolkit-Unity
https://aka.ms/mrtkdocs
MIT License
6k stars 2.12k forks source link

upgrade error : "MSBUILD : error MSB1008" #7408

Closed IfnoLee closed 3 years ago

IfnoLee commented 4 years ago

Describe the bug

Show errors after upgrade project from v2.1.0 to v2.3.0. It is not ok after that delete Library folder and reopen project. MSBUILD : error MSB1008.

To reproduce

Steps to reproduce the behavior:

  1. upgrade Project from V2.1.0 to V2.3.0
  2. show errors for each open project

Screenshots

image image image image image

Your setup (please complete the following information)

Target platform (please complete the following information)

jasonhbartlett commented 4 years ago

I'm getting this error even with a brand new empty project.

Unity 2018.4.20f1 MRTK Release 2.3.0

After importing packages and set project to UWP - Mixed Reality Toolkit > Utilities > Configure Unity Project > Enable MSBuild for Unity

Close and reopen Unity and get this error.

Is MSbuild for Unity optional or required for MRTK 2.3.0 use?

keveleigh commented 4 years ago

Is MSbuild for Unity optional or required for MRTK 2.3.0 use?

MSBuild for Unity isn't required, but adds access to additional features. Currently those feature revolve around HoloLens 2, with most of them relating to holographic remoting from the editor. If you don't use HoloLens 2, you don't need it (currently, though we may add more features in the future on different devices).

jasonhbartlett commented 4 years ago

I am developing for HL2 and I'm now on MRTK v2.3.0 but have left MSBuild for Unity disabled. I would like to enable it but I would really like:

  1. Not to get this error:

    MSBUILD : error MSB1008: Only one project can be specified.
    UnityEngine.Debug:LogError(Object)
    Microsoft.Build.Unity.MSBuildProjectBuilder:LogProgressMessage(String, ProgressMessageType) (at Library/PackageCache/com.microsoft.msbuildforunity@0.9.1-20200131.14/Editor/ProjectBuilder/MSBuildProjectBuilder.cs:385)
    Microsoft.Build.Unity.<>c__DisplayClass13_0:<BuildProjects>b__1(ValueTuple`2) (at Library/PackageCache/com.microsoft.msbuildforunity@0.9.1-20200131.14/Editor/ProjectBuilder/MSBuildProjectBuilder.cs:213)
    Microsoft.Build.Unity.DelegateProgress`1:Report(ValueTuple`2) (at Library/PackageCache/com.microsoft.msbuildforunity@0.9.1-20200131.14/Editor/ProjectBuilder/MSBuildProjectBuilder.cs:516)
    Microsoft.Build.Unity.<>c__DisplayClass14_0:<BuildProjectsAsync>b__1(ValueTuple`2) (at Library/PackageCache/com.microsoft.msbuildforunity@0.9.1-20200131.14/Editor/ProjectBuilder/MSBuildProjectBuilder.cs:330)
    Microsoft.Build.Unity.DelegateProgress`1:Report(ValueTuple`2) (at Library/PackageCache/com.microsoft.msbuildforunity@0.9.1-20200131.14/Editor/ProjectBuilder/MSBuildProjectBuilder.cs:516)
    Microsoft.Build.Unity.<>c__DisplayClass21_0:<ExecuteMSBuildAsync>b__0(Object, DataReceivedEventArgs) (at Library/PackageCache/com.microsoft.msbuildforunity@0.9.1-20200131.14/Editor/ProjectBuilder/MSBuildProjectBuilder.cs:462)
    System.Threading._ThreadPoolWaitCallback:PerformWaitCallback()
  2. A really simple tutorial about what MSBuild for Unity is! I'm not an super experienced .NET developer and so I have no idea what this does for helping to develop MR applications in Unity. I've tried reading the docs at MSBuildForUnity GitHub page but its pretty confusing and I am having a hard time grasping it. (Let alone try to figure out how to troubleshoot my this error I'm getting when I enable it in my MRTK Unity project.)

  3. Are there docs explaining how MRTK uses it and how it improves developer workflow?

(FYI - we are pretty early in the development of our project so I may go ahead and start from scratch following the instructions of setting up a new project with Nuget for Unity to import MRTK. Perhaps that will be smoother? The only thing is that my project uses Mapbox for Unity SDK which unfortunately doesn't yet support IL2CPP if targeting UWP and therefore I'm having to stay at Unity > 2018.4 :( )

jasonhbartlett commented 4 years ago

Hi @keveleigh I went through the Debugging HoloLens 2 remoting via Unity package import readme and everything checks out except for when I get to the section about adding DOTNETWINRT_PRESENT to the scripting define symbols. The field shows blank, and when I try to enter the symbol, it doesn't save!? I click away and then back and the field is empty again? Any thoughts? Regarding this issue, since I AM developing for HL2 I really do want Remoting to work correctly. What would you recommned? Should do the Manual DotNetAdapter installation? Will that allow Holographic Remoting to work?

keveleigh commented 4 years ago

The field shows blank, and when I try to enter the symbol, it doesn't save!? I click away and then back and the field is empty again?

This sounds like the DotNetWinRT DLL isn't present in your Assets folder (the step "DotNetWinRT NuGet package resolution"). MRTK looks for that DLL and writes / removes the symbol as required. So, if you're unable to save it, likely MRTK is overwriting it due to a missing DLL.

Yeah, if MSBuildForUnity is causing problems, I'd recommend manual DotNetAdapter installation in your case. That should still allow everything to work.

jasonhbartlett commented 4 years ago

@keveleigh No, I forgot to mention that it doesn't exist and following the instructions to click the Build or Rebuild buttons doesn't create it. That's when I just get this "MSBUILD : error MSB1008: Only one project can be specified." error.

Okay, I want to try manual DotNetAdapter installation. Do I need to Uninstall MSBuild for Unity first? The Readme has the warning that "Using both MSBuild for Unity and another NuGet client within the same project is not supported." But, the instructions don't say to uninstall MSBuild for Unity first???

keveleigh commented 4 years ago

@jasonhbartlett Yep, I'd follow https://microsoft.github.io/MixedRealityToolkit-Unity/Documentation/Tools/HolographicRemoting.html#removing-hololens-2-specific-remoting-support for uninstallation instructions.

But, the instructions don't say to uninstall MSBuild for Unity first???

Ahh, I think those are assuming you're starting from scratch. I can add a reference to the uninstallation steps in case others are starting from where you are.

jasonhbartlett commented 4 years ago

@keveleigh Okay, that worked. Recommend adding note about deleting any existing NuGet.config file before importing NuGet for Unity package into your project. Ref this issue on NugetForUnity github

Tested out and the Holographic Remoting works again! Sweet!

jasonhbartlett commented 4 years ago

@keveleigh Hmmm... tried building and getting this error: Any ideas?

I'll try deleting and reimporting MRTK, and other packages I guess.

UnityException: Failed to run reference rewriter with command "--target=Temp\StagingArea\Assembly-CSharp.dll" "--target=Temp\StagingArea\Microsoft.MixedReality.Toolkit.Providers.WindowsMixedReality.Shared.dll" "--target=Temp\StagingArea\Microsoft.MixedReality.Toolkit.Providers.WindowsMixedReality.dll" "--target=Temp\StagingArea\Microsoft.MixedReality.Toolkit.Gltf.dll" "--target=Temp\StagingArea\Microsoft.MixedReality.Toolkit.Extensions.Tracking.dll" "--target=Temp\StagingArea\Microsoft.MixedReality.Toolkit.Extensions.SceneTransitionService.dll" "--target=Temp\StagingArea\Microsoft.MixedReality.Toolkit.Extensions.HandPhysics.dll" "--target=Temp\StagingArea\Microsoft.MixedReality.Toolkit.Examples.dll" "--target=Temp\StagingArea\Microsoft.MixedReality.Toolkit.dll" "--target=Temp\StagingArea\Microsoft.MixedReality.Toolkit.Demos.UX.Interactables.dll" "--target=Temp\StagingArea\Microsoft.MixedReality.Toolkit.Demos.InspectorFields.dll" "--target=Temp\StagingArea\Microsoft.MixedReality.Toolkit.Demos.Gltf.dll" "--target=Temp\StagingArea\Microsoft.MixedReality.Toolkit.Async.dll" "--target=Temp\StagingArea\Microsoft.MixedReality.Toolkit.Providers.WindowsVoiceInput.dll" "--target=Temp\StagingArea\Microsoft.MixedReality.Toolkit.SDK.dll" "--target=Temp\StagingArea\Microsoft.MixedReality.Toolkit.Services.BoundarySystem.dll" "--target=Temp\StagingArea\Microsoft.MixedReality.Toolkit.Services.CameraSystem.dll" "--target=Temp\StagingArea\Unity.XR.WindowsMR.dll" "--target=Temp\StagingArea\Unity.TextMeshPro.dll" "--target=Temp\StagingArea\Unity.Analytics.DataPrivacy.dll" "--target=Temp\StagingArea\Microsoft.MixedReality.Toolkit.Tools.Runtime.dll" "--target=Temp\StagingArea\Microsoft.MixedReality.Toolkit.Services.TeleportSystem.dll" "--target=Temp\StagingArea\Microsoft.MixedReality.Toolkit.Services.SpatialAwarenessSystem.dll" "--target=Temp\StagingArea\Microsoft.MixedReality.Toolkit.Services.SceneSystem.dll" "--target=Temp\StagingArea\Microsoft.MixedReality.Toolkit.Services.InputSystem.dll" "--target=Temp\StagingArea\Microsoft.MixedReality.Toolkit.Services.InputSimulation.dll" "--target=Temp\StagingArea\Microsoft.MixedReality.Toolkit.Services.InputAnimation.dll" "--target=Temp\StagingArea\Microsoft.MixedReality.Toolkit.Services.DiagnosticsSystem.dll" "-- .......<message truncated>

jasonhbartlett commented 4 years ago

@keveleigh Okay, it appears that importing specifically the DotNetWinRT package (with NuGet for Unity) is the cause for the above UnityException. :(

Fortunately I have a work-around for building my project. If I simply uninstall that DotNetWinRT package and clear DOTNETWINRT_PRESENT out of the Scripting Define Symbols before attempting to build, then my project builds successfully.

So I at least have a way of still using the Holographic Remoting and having the hand interactions fully work by installing that DotNetWinRT package, but still being able to build by removing it.

I'll take whatever I can get I suppose. Have submitted an issue at the N4U GitHub page here: Issue 332

stale[bot] commented 3 years ago

This issue has been marked as stale by an automated process because it has not had any recent activity. It will be automatically closed in 30 days if no further activity occurs. If this is still an issue please add a new comment with more recent details and repro steps.

stale[bot] commented 3 years ago

This issue has been closed by an automated process because it is stale. If this is still an issue please add a new comment with more recent details and repro steps.