Mixedrealitytoolkit-unity: HoloToolkit build is not compatible with Visual Studio 2017 and MSBuild 15.0

Created on 10 Apr 2017  路  6Comments  路  Source: microsoft/MixedRealityToolkit-Unity

In the official HoloLens documentation, Visual Studio 2017 is supported (https://developer.microsoft.com/en-us/windows/mixed-reality/install_the_tools)

Since Visual Studio 2017, MSBuild 15.0 is not longer a standalone package and we can install different versions, each are in a subfolder of Visual Studio.

However, Holotoolkit is relying on registry key, that is right with previous version of Visual Studio 2017 :

        public static string CalcMSBuildPath(string msBuildVersion)
        {
            using (Microsoft.Win32.RegistryKey key = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(string.Format(@"Software\Microsoft\MSBuild\ToolsVersions\{0}", msBuildVersion)))
            {
                if (key == null)
                {
                    return null;
                }
                string msBuildBinFolder = key.GetValue("MSBuildToolsPath") as string;
                string msBuildPath = Path.Combine(msBuildBinFolder, "msbuild.exe");
                return msBuildPath;
            }
        }

The file https://github.com/Microsoft/HoloToolkit-Unity/blob/master/Assets/HoloToolkit/Build/Editor/BuildDeployTools.cs should be changed to take new MSBuild location into account.

Thanks

All 6 comments

Here are some links to blog posts that detail some of the currently supported ways to find these paths:

https://blogs.msdn.microsoft.com/heaths/2016/09/15/changes-to-visual-studio-15-setup/

https://blogs.msdn.microsoft.com/vcblog/2017/03/06/finding-the-visual-c-compiler-tools-in-visual-studio-2017/

I think we would need to query the path for the Microsoft.VisualStudio.Workload.MSBuildTools workload specifically.

There was some work done for our Mixed Reality update by @mrbobbybobberson that I believe addresses some of this:

https://github.com/Microsoft/HoloToolkit-Unity/pull/572/files#diff-915d8ae44ef16ebac775ab81e0cdf317
https://github.com/Microsoft/HoloToolkit-Unity/pull/572/files#diff-36c5c2dc3e0a8351f7a8dffb3ef72467

Any updates on this issue? I changed the build files, but unity still crashes. I changed BuildSLNUtilities, BuildDeployTools and I also added UwpProjectPostProcess file to editor folder.

@LifeAlchemist - After replacing the files that you did, I also hard-coded the calcMSBuildPatch method in BuildDeployTools.cs to return the path to my MSBuild 15 instance. Mine is at
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\msbuild.exe

Yours should be at a similar path, just replacing Professional with whatever version of VS2017 you are running, if it's not professional.

Ended up going going the route of vswhere like @thebanjomatic pointed out.

That's the right way to do it. I just didn't have the time to figure it out...

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Alexees picture Alexees  路  3Comments

brean picture brean  路  3Comments

dustin2711 picture dustin2711  路  3Comments

StephenHodgson picture StephenHodgson  路  3Comments

jimstack picture jimstack  路  3Comments