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
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/
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...