1 [CmdletBinding
(PositionalBinding
=$false)]
3 [string
][Alias
('c')]$configuration = "Debug",
4 [string
]$platform = $null,
6 [string
][Alias
('v')]$verbosity = "minimal",
7 [string
] $msbuildEngine = $null,
8 [bool
] $warnAsError = $true,
9 [bool
] $nodeReuse = $true,
10 [switch][Alias
('r')]$restore,
12 [switch][Alias
('b')]$build,
15 [switch][Alias
('t')]$test,
16 [switch] $integrationTest,
17 [switch] $performanceTest,
21 [switch][Alias
('bl')]$binaryLog,
23 [switch] $prepareMachine,
25 [Parameter
(ValueFromRemainingArguments
=$true)][String
[]]$properties
28 . $PSScriptRoot\tools
.ps1
30 function Print-Usage
() {
31 Write-Host "Common settings:"
32 Write-Host " -configuration <value> Build configuration: 'Debug' or 'Release' (short: -c)"
33 Write-Host " -platform <value> Platform configuration: 'x86', 'x64' or any valid Platform value to pass to msbuild"
34 Write-Host " -verbosity <value> Msbuild verbosity: q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic] (short: -v)"
35 Write-Host " -binaryLog Output binary log (short: -bl)"
36 Write-Host " -help Print help and exit"
40 Write-Host " -restore Restore dependencies (short: -r)"
41 Write-Host " -build Build solution (short: -b)"
42 Write-Host " -rebuild Rebuild solution"
43 Write-Host " -deploy Deploy built VSIXes"
44 Write-Host " -deployDeps Deploy dependencies (e.g. VSIXes for integration tests)"
45 Write-Host " -test Run all unit tests in the solution (short: -t)"
46 Write-Host " -integrationTest Run all integration tests in the solution"
47 Write-Host " -performanceTest Run all performance tests in the solution"
48 Write-Host " -pack Package build outputs into NuGet packages and Willow components"
49 Write-Host " -sign Sign build outputs"
50 Write-Host " -publish Publish artifacts (e.g. symbols)"
53 Write-Host "Advanced settings:"
54 Write-Host " -projects <value> Semi-colon delimited list of sln/proj's to build. Globbing is supported (*.sln)"
55 Write-Host " -ci Set when running on CI server"
56 Write-Host " -prepareMachine Prepare machine for CI run, clean up processes after build"
57 Write-Host " -warnAsError <value> Sets warnaserror msbuild parameter ('true' or 'false')"
58 Write-Host " -msbuildEngine <value> Msbuild engine to use to run build ('dotnet', 'vs', or unspecified)."
61 Write-Host "Command line arguments not listed above are passed thru to msbuild."
62 Write-Host "The above arguments can be shortened as much as to be unambiguous (e.g. -co for configuration, -t for test, etc.)."
65 function InitializeCustomToolset
{
70 $script = Join-Path $EngRoot "restore-toolset.ps1"
72 if (Test-Path $script) {
78 $toolsetBuildProj = InitializeToolset
79 InitializeCustomToolset
81 $bl = if ($binaryLog) { "/bl:" + (Join-Path $LogDir "Build.binlog") } else { "" }
82 $platformArg = if ($platform) { "/p:Platform=$platform" } else { "" }
85 # Re-assign properties to a new variable because PowerShell doesn't let us append properties directly for unclear reasons.
86 # Explicitly set the type as string[] because otherwise PowerShell would make this char[] if $properties is empty.
87 [string
[]] $msbuildArgs = $properties
88 $msbuildArgs += "/p:Projects=$projects"
89 $properties = $msbuildArgs
92 MSBuild
$toolsetBuildProj `
95 /p
:Configuration
=$configuration `
96 /p
:RepoRoot
=$RepoRoot `
98 /p
:DeployDeps
=$deployDeps `
100 /p
:Rebuild
=$rebuild `
104 /p
:IntegrationTest
=$integrationTest `
105 /p
:PerformanceTest
=$performanceTest `
107 /p
:Publish
=$publish `
112 if ($help -or
(($null -ne
$properties) -and
($properties.Contains
("/help") -or
$properties.Contains
("/?")))) {
122 # Import custom tools configuration, if present in the repo.
123 # Note: Import in global scope so that the script set top-level variables without qualification.
124 $configureToolsetScript = Join-Path $EngRoot "configure-toolset.ps1"
125 if (Test-Path $configureToolsetScript) {
126 . $configureToolsetScript
129 if (($restore) -and
($null -eq
$env:DisableNativeToolsetInstalls
)) {
130 InitializeNativeTools
137 Write-Host $_.Exception
138 Write-Host $_.ScriptStackTrace