|
| 1 | +@ECHO OFF |
| 2 | +SETLOCAL ENABLEDELAYEDEXPANSION |
| 3 | + |
| 4 | +CALL %~dp0\InitializeEnvironment.bat || EXIT /b 10 |
| 5 | + |
| 6 | +IF "%1"=="" (SET "Configuration=Debug") ELSE (SET "Configuration=%1") |
| 7 | +IF "%2"=="" (SET "ProjFSManagedVersion=0.2.173.2") ELSE (SET "ProjFSManagedVersion=%2") |
| 8 | + |
| 9 | +SET SolutionConfiguration=%Configuration% |
| 10 | + |
| 11 | +:: Make the build version available in the DevOps environment. |
| 12 | +@echo ##vso[task.setvariable variable=PROJFS_MANAGED_VERSION]%ProjFSManagedVersion% |
| 13 | + |
| 14 | +SET nuget="%PROJFS_TOOLSDIR%\nuget.exe" |
| 15 | +IF NOT EXIST %nuget% ( |
| 16 | + mkdir %nuget%\.. |
| 17 | + powershell -ExecutionPolicy Bypass -Command "Invoke-WebRequest 'https://dist.nuget.org/win-x86-commandline/latest/nuget.exe' -OutFile %nuget%" |
| 18 | +) |
| 19 | + |
| 20 | +:: Use vswhere to find the latest VS installation (including prerelease installations) with the msbuild component. |
| 21 | +:: See https://github.com/Microsoft/vswhere/wiki/Find-MSBuild |
| 22 | +SET vswherever=2.8.4 |
| 23 | +%nuget% install vswhere -Version %vswherever% -OutputDirectory %PROJFS_PACKAGESDIR% || exit /b 1 |
| 24 | +SET vswhere=%PROJFS_PACKAGESDIR%\vswhere.%vswherever%\tools\vswhere.exe |
| 25 | +set WINSDK_BUILD=19041 |
| 26 | +echo Checking for VS installation: |
| 27 | +echo %vswhere% -all -prerelease -latest -version "[16.4,18.0)" -products * -requires Microsoft.Component.MSBuild Microsoft.VisualStudio.Workload.ManagedDesktop Microsoft.VisualStudio.Workload.NativeDesktop Microsoft.VisualStudio.Component.Windows10SDK.%WINSDK_BUILD% Microsoft.VisualStudio.Component.VC.CLI.Support -property installationPath |
| 28 | +for /f "usebackq tokens=*" %%i in (`%vswhere% -all -prerelease -latest -version "[16.4,18.0)" -products * -requires Microsoft.Component.MSBuild Microsoft.VisualStudio.Workload.ManagedDesktop Microsoft.VisualStudio.Workload.NativeDesktop Microsoft.VisualStudio.Component.Windows10SDK.%WINSDK_BUILD% Microsoft.VisualStudio.Component.VC.CLI.Support -property installationPath`) do ( |
| 29 | + set VsDir=%%i |
| 30 | +) |
| 31 | + |
| 32 | +IF NOT DEFINED VsDir ( |
| 33 | + echo All installed Visual Studio instances: |
| 34 | + %vswhere% -all -prerelease -products * -format json |
| 35 | + echo ERROR: Could not locate a Visual Studio installation with required components. |
| 36 | + echo Refer to Readme.md for a list of the required Visual Studio components. |
| 37 | + exit /b 10 |
| 38 | +) |
| 39 | + |
| 40 | +echo Setting up the VS Developer Command Prompt environment variables from %VsDir% |
| 41 | +call "%VsDir%\VC\Auxiliary\Build\vcvarsall.bat" x86_amd64 |
| 42 | +@rem pushd "%VsDir%" |
| 43 | +@rem call "%VsDir%\Common7\Tools\VsDevCmd.bat" |
| 44 | +@rem popd |
| 45 | + |
| 46 | +:: Restore all dependencies and run the build. |
| 47 | +pushd "%PROJFS_SRCDIR%" |
| 48 | +msbuild /t:Restore ProjectedFSLib.Managed.sln |
| 49 | +msbuild ProjectedFSLib.Managed.sln /p:ProjFSManagedVersion=%ProjFSManagedVersion% /p:Configuration=%SolutionConfiguration% /p:Platform=x64 || exit /b 1 |
| 50 | +popd |
| 51 | + |
| 52 | +ENDLOCAL |
0 commit comments