-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbuild.ps1
23 lines (19 loc) · 905 Bytes
/
build.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
Param ($Version = "1.0-dev")
$ErrorActionPreference = "Stop"
pushd $PSScriptRoot
function Find-MSBuild {
if (Test-Path "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe") {
$vsDir = . "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -products * -property installationPath -format value
if ($vsDir) {
if (Test-Path "$vsDir\MSBuild\Current") { return "$vsDir\MSBuild\Current\Bin\amd64\MSBuild.exe" } else { return "$vsDir\MSBuild\15.0\Bin\amd64\MSBuild.exe" }
}
}
}
function Run-MSBuild {
$msbuild = Find-Msbuild
if (!$msbuild) { throw "You need Visual Studio 2019 v16.5+ to build this project" }
. $msbuild @args
if ($LASTEXITCODE -ne 0) {throw "Exit Code: $LASTEXITCODE"}
}
Run-MSBuild /v:Quiet /t:Restore /t:Build /p:Configuration=Release /p:Version=$Version src
popd