summaryrefslogtreecommitdiff
path: root/PCbuild/find_msbuild.bat
diff options
context:
space:
mode:
authorSteve Dower <steve.dower@microsoft.com>2018-12-06 21:09:20 -0800
committerGitHub <noreply@github.com>2018-12-06 21:09:20 -0800
commit468a15aaf9206448a744fc5eab3fc21f51966aad (patch)
tree75c8f2aae7835ae7ca718ef8660a4c0899837bd3 /PCbuild/find_msbuild.bat
parentc9566b8c454120e3d0ddb5ab970f262a6cd80077 (diff)
downloadcpython-git-468a15aaf9206448a744fc5eab3fc21f51966aad.tar.gz
bpo-34977: Add Windows App Store package (GH-10245)
Diffstat (limited to 'PCbuild/find_msbuild.bat')
-rw-r--r--PCbuild/find_msbuild.bat10
1 files changed, 10 insertions, 0 deletions
diff --git a/PCbuild/find_msbuild.bat b/PCbuild/find_msbuild.bat
index 57512a0192..a2810f09c4 100644
--- a/PCbuild/find_msbuild.bat
+++ b/PCbuild/find_msbuild.bat
@@ -29,6 +29,16 @@
@where msbuild > "%TEMP%\msbuild.loc" 2> nul && set /P MSBUILD= < "%TEMP%\msbuild.loc" & del "%TEMP%\msbuild.loc"
@if exist "%MSBUILD%" set MSBUILD="%MSBUILD%" & (set _Py_MSBuild_Source=PATH) & goto :found
+@rem VS 2017 and later provide vswhere.exe, which can be used
+@if not exist "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" goto :skip_vswhere
+@set _Py_MSBuild_Root=
+@for /F "tokens=*" %%i in ('"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -property installationPath -latest') DO @(set _Py_MSBuild_Root=%%i\MSBuild)
+@if not defined _Py_MSBuild_Root goto :skip_vswhere
+@for %%j in (Current 15.0) DO @if exist "%_Py_MSBuild_Root%\%%j\Bin\msbuild.exe" (set MSBUILD="%_Py_MSBuild_Root%\%%j\Bin\msbuild.exe")
+@set _Py_MSBuild_Root=
+@if defined MSBUILD @if exist %MSBUILD% (set _Py_MSBuild_Source=Visual Studio installation) & goto :found
+:skip_vswhere
+
@rem VS 2017 sets exactly one install as the "main" install, so we may find MSBuild in there.
@reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\SxS\VS7" /v 15.0 /reg:32 >nul 2>nul
@if NOT ERRORLEVEL 1 @for /F "tokens=1,2*" %%i in ('reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\SxS\VS7" /v 15.0 /reg:32') DO @(