-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathbuild.ps1
More file actions
32 lines (27 loc) · 1.13 KB
/
build.ps1
File metadata and controls
32 lines (27 loc) · 1.13 KB
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
28
29
30
31
32
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 -version 18.0
if ($vsDir) { return "$vsDir\MSBuild\Current\Bin\amd64\MSBuild.exe" }
}
}
function Run-DotNet {
..\0install.ps1 run --batch --version 10.0.. https://apps.0install.net/dotnet/sdk.xml @args
if ($LASTEXITCODE -ne 0) {throw "Exit Code: $LASTEXITCODE"}
}
function Run-MSBuild {
$msbuild = Find-MSBuild
if ($msbuild) {
. $msbuild @args
if ($LASTEXITCODE -ne 0) {throw "Exit Code: $LASTEXITCODE"}
} else {
Write-Warning "You need Visual Studio 2026 v18.0 or newer to perform a full build of this project"
Run-DotNet msbuild @args
}
}
# Build
if ($env:CI) { $ci = "/p:ContinuousIntegrationBuild=True" }
Run-MSBuild /v:Quiet /t:Restore /t:Build /p:Configuration=Release /p:Version=$Version $ci
popd