Mixedrealitytoolkit-unity: MSBuild path and other issues causing fatal errors on Mac

Created on 20 Dec 2019  路  11Comments  路  Source: microsoft/MixedRealityToolkit-Unity

Describe the bug

Leaving the MS Build option checked in the Configure Unity Project causes fatal errors in the project which can also crash Unity.

The errors happen with even just the Foundation package added to the project. In various scenarios I tried you can seem to get past the errors and even deploy but the project will remain broken in various ways.

Switching the Build Platform to iOS, apply VR, close and reopen the project and you get an endless loop where it attempts to access MS Build and locks Unity (technically not locked as if you click the close button a dozen times and eventually get between the loop iterations to close the editor).

To reproduce

  1. On Mac create a new project.
  2. Add the MRTK Foundation package
  3. From the Menu, Mixed Reality Toolkit : Utilities : Configure Unity Project, Apply the default configuration with MSBuild option checked

Expected behavior

No errors, and/or if MSBuild isn't supposed to work on Mac, some process to uncheck that option for a new project and to disable it on a previously created project.

Screenshots

Screen Shot 2019-12-20 at 7 39 49 AM

Your setup (please complete the following information)

  • Unity Version 2019,2.17 (same on .14)
  • MRTK Version 2.2

Target platform (please complete the following information)

Any target but issue only happens on Mac

Additional context

The error happens on projects created on Windows (where MS Build works) and downloaded to a Mac from the cloud, and on locally created projects.

I'm not certain if MSBuild is expected to work on Mac so I'm not certain what the right fix is but:

a) there is a path problem, for example:

System.IO.DirectoryNotFoundException: Could not find a part of the path '/Applications/Unity/Hub/Editor/2019.2.14f1/Data\Resources\PackageManager\BuiltInPackages'.

The path above is mostly exists but the part at "/Data" is different than what appears on may machine.

b) If MSBuild isn't meant for Mac than the default configuration needs to uncheck the option, though even there a project created oh Windows and loaded on Mac has the same issue

c) there is no way to uncheck a configuration option, the dialog says Modify Settings but once checked you cannot uncheck an option. Further, there is no information about where these values are applied so not clear where in the project you could go to undo this -- starting over is currently the only option.

Screen Shot 2019-12-20 at 8 03 14 AM

Creating a new project, going through all the steps but unchecking the MSBuild option before applying allowed me to complete a default project without the errors and deploy it to an iPad without any obvious issues, though I do not know what might be missing as a result of not having MSBuild.

Bug MSBuild Package Management - NuGet Release Blocker

Most helpful comment

As a workaround, if you're able to go into the Unity Package Manager and remove MS Build for Unity that should help you get back up and running until the above PR is shipped.
If you aren't able to open that window, you should be able to open the manifest.json file in your Packages folder and manually remove it.

All 11 comments

On Mac support, looks like that's being added by @andreiborodin via https://github.com/microsoft/MSBuildForUnity/pull/91

Having the same problem... can not use MRTK ... in my case also crashes when adding ARCore XR Plugin Version: 2.1.2

As a workaround, if you're able to go into the Unity Package Manager and remove MS Build for Unity that should help you get back up and running until the above PR is shipped.
If you aren't able to open that window, you should be able to open the manifest.json file in your Packages folder and manually remove it.

Another workaround is making a change in /Library/PackageCache/com.microsoft.[email protected]/Editor/Utilities.cs

Replace this line
private const string BuiltInPackagesRelativePath = @"Data\Resources\PackageManager\BuiltInPackages";

with this

if UNITY_EDITOR_OSX

private const string BuiltInPackagesRelativePath = @"Unity.app/Contents/Resources/PackageManager/BuiltInPackages";

else

private const string BuiltInPackagesRelativePath = @"Data\Resources\PackageManager\BuiltInPackages";

endif

Thank you guys, worked removing manually the MSBuild option. Now works perfectly.

@keveleigh and @andreiborodin I still get the infinite loop described here when I select "enable msbuild for unity" on the 2.3 prerelease branch. Not on mrtk_development though.

on the 2.3 prerelease branch. Not on mrtk_development though.

Huh...I can't think of any changes that could have changed this behavior between the two. Strange...

@julenka / @keveleigh any update on this?

@Troy-Ferrell I don't have a mac to repro with, unfortunately. Dependent on @julenka (and @andreiborodin, if this is an MSBuildForUnity issue still?) to resolve.

looks like part of the problem is another instance of '\' in paths on mac

from @seltar's comment, this issue is in the msbuildforunity code... will work with @andreiborodin on a fix

Was this page helpful?
0 / 5 - 0 ratings