forked from microsoft/ApplicationInsights-dotnet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
findMsBuild.cmd
27 lines (20 loc) · 860 Bytes
/
findMsBuild.cmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
@echo off
IF NOT DEFINED VSVERSION SET VSVERSION=15.0
IF DEFINED MSBUILD (
IF EXIST "%MSBUILD%" GOTO :eof
)
SET VSWHERE=..\packages\vswhere\tools\vswhere.exe
IF NOT EXIST "%VSWHERE%" nuget.exe install vswhere -NonInteractive -ExcludeVersion -Source https://www.nuget.org/api/v2 > nul
FOR /f "usebackq tokens=*" %%i in (`"%VSWHERE%" -version %VSVERSION% -products * -requires Microsoft.Component.MSBuild -property installationPath`) DO (
SET MSBUILD=%%i\MSBuild\%VSVERSION%\Bin\MSBuild.exe
)
IF NOT DEFINED MSBUILD (
ECHO Could not find MSBuild %VSVERSION%. Please SET MSBUILD=^<path-to-MSBuild.exe^> and try again.
GOTO :eof
)
IF NOT EXIST "%MSBUILD%" (
ECHO vswhere.exe claims that MSBuild is at !MSBUILD! but it does not exist.
ECHO Please SET MSBUILD=^<path-to-MSBuild.exe^> and try again.
GOTO :eof
)
ECHO Using MSBuild from %MSBUILD%