@@ -6,7 +6,7 @@ mkdir bin
66
77:Build
88
9- REM Require VS2019 (v16 .0) on the system. Use `vswhere` for the search because it can find all VS installations.
9+ REM Require VS2022 (v17 .0) on the system. Use `vswhere` for the search because it can find all VS installations.
1010set vswhere = " %ProgramFiles(x86)% \Microsoft Visual Studio\Installer\vswhere.exe"
1111if not exist %vswhere% (
1212 set vswhere = " %ProgramFiles% \Microsoft Visual Studio\Installer\vswhere.exe"
@@ -23,7 +23,7 @@ if not exist %vswhere% (
2323)
2424
2525set InstallDir =
26- for /f " usebackq tokens=*" %%i in (`%vswhere% -version 16 -latest -prerelease -products * ^
26+ for /f " usebackq tokens=*" %%i in (`%vswhere% -version 17 -latest -prerelease -products * ^
2727 -requires Microsoft.Net.Component.4.5.TargetingPack ^
2828 -requires Microsoft.Net.Component.4.5.2.TargetingPack ^
2929 -requires Microsoft.Net.Component.4.6.2.TargetingPack ^
@@ -32,41 +32,11 @@ for /f "usebackq tokens=*" %%i in (`%vswhere% -version 16 -latest -prerelease -p
3232)
3333
3434if not DEFINED InstallDir (
35- echo " Could not find a VS2019 installation with the necessary components (targeting packs for v4.5, v4.5.2, and v4.6.2)."
36- echo Please install VS2019 or the missing components.
35+ echo " Could not find a VS2022 installation with the necessary components (targeting packs for v4.5, v4.5.2, and v4.6.2)."
36+ echo Please install VS2022 or the missing components.
3737 goto BuildFail
3838)
3939
40- REM Find a 64bit MSBuild and add it to path. Require v17.4 or later due to our .NET SDK choice.
41- REM Check for VS2022 first.
42- set InstallDir =
43- for /f " usebackq tokens=*" %%i in (`%vswhere% -version 17.4 -latest -prerelease -products * ^
44- -requires Microsoft.Component.MSBuild ^
45- -property installationPath`) do (
46- set " InstallDir = %%i "
47- )
48-
49- if DEFINED InstallDir (
50- REM Add MSBuild to the path.
51- set " PATH = %InstallDir% \MSBuild\Current\Bin;%PATH% "
52- goto FoundMSBuild
53- )
54-
55- REM Otherwise find or install an xcopy-able MSBuild.
56- echo " Could not find a VS2022 installation with the necessary components (MSBuild). Falling back..."
57-
58- set " MSBuildVersion = 17.4.1"
59- set " Command = [System.Threading.Thread]::CurrentThread.CurrentCulture = ''"
60- set " Command = %Command% ; [System.Threading.Thread]::CurrentThread.CurrentUICulture = ''"
61- set " Command = %Command% ; try { & '%~dp0 eng\GetXCopyMSBuild.ps1' %MSBuildVersion% ; exit $LASTEXITCODE }"
62- set " Command = %Command% catch { write-host $_; exit 1 }"
63- PowerShell -NoProfile -NoLogo -ExecutionPolicy Bypass -Command " %Command% "
64- if %ERRORLEVEL% neq 0 goto BuildFail
65-
66- REM Add MSBuild to the path.
67- set " PATH = %~dp0 .msbuild\%MSBuildVersion% \tools\MSBuild\Current\Bin;%PATH% "
68-
69- :FoundMSBuild
7040REM Configure NuGet operations to work w/in this repo i.e. do not pollute system packages folder.
7141REM Note this causes two copies of packages restored using packages.config to land in this folder e.g.
7242REM StyleCpy.5.0.0/ and stylecop/5.0.0/.
0 commit comments