Example scripts to locate and run msbuild
This commit is contained in:
Родитель
23e71b347b
Коммит
80426ad4ba
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="vswhere" version="2.2.11" />
|
||||
</packages>
|
|
@ -0,0 +1,22 @@
|
|||
@REM Copyright (C) Microsoft Corporation. All rights reserved.
|
||||
@REM Licensed under the MIT license. See LICENSE.txt in the project root for license information.
|
||||
|
||||
@if not defined _echo echo off
|
||||
setlocal enabledelayedexpansion
|
||||
|
||||
@REM Determine if MSBuild is already in the PATH
|
||||
for /f "usebackq delims=" %%I in (`where msbuild.exe 2^>nul`) do (
|
||||
"%%I" %*
|
||||
exit /b !ERRORLEVEL!
|
||||
)
|
||||
|
||||
@REM Find the latest MSBuild that supports our projects
|
||||
for /f "usebackq delims=" %%I in (`call "%~dp0vswhere.cmd" -version "[15.0,)" -latest -prerelease -products * -requires Microsoft.Component.MSBuild Microsoft.VisualStudio.Component.Roslyn.Compiler Microsoft.VisualStudio.Component.VC.140 -property InstallationPath`) do (
|
||||
for /f "usebackq delims=" %%J in (`where /r "%%I\MSBuild" msbuild.exe 2^>nul ^| sort /r`) do (
|
||||
"%%J" %*
|
||||
exit /b !ERRORLEVEL!
|
||||
)
|
||||
)
|
||||
|
||||
echo Could not find msbuild.exe 1>&2
|
||||
exit /b 2
|
|
@ -0,0 +1,12 @@
|
|||
@REM Copyright (C) Microsoft Corporation. All rights reserved.
|
||||
@REM Licensed under the MIT license. See LICENSE.txt in the project root for license information.
|
||||
|
||||
@if not defined _echo echo off
|
||||
setlocal enabledelayedexpansion
|
||||
|
||||
for /f "usebackq delims=" %%I in (`dir /b /aD /o-N /s "%~dp0..\packages\vswhere*"`) do (
|
||||
for /f "usebackq delims=" %%J in (`where /r "%%I" vswhere.exe 2^>nul`) do (
|
||||
"%%J" %*
|
||||
exit /b !ERRORLEVEL!
|
||||
)
|
||||
)
|
Загрузка…
Ссылка в новой задаче