Skip to content

Commit c24801f

Browse files
Explicitly set the build platform, suppress loading of PS profile.
Also add a -MsBuildVerbosity param to build.ps1. Some people default to using a platform-specific msbuild window, but our project only supports 'AnyCPU'. -NoProfile will help PS to load faster, and also prevent problems when people have weird stuff in their $profile.
1 parent 4e4bc2d commit c24801f

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

build.ps1

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,14 @@ The project configuration to build.
88
Param(
99
[Parameter()]
1010
[ValidateSet('Debug', 'Release')]
11-
[string]$Configuration
11+
[string]$Configuration,
12+
13+
[Parameter()]
14+
[ValidateSet('minimal', 'normal', 'detailed', 'diagnostic')]
15+
[string]$MsBuildVerbosity = 'minimal'
1216
)
1317

14-
$msbuildCommandLine = "msbuild `"$PSScriptRoot\src\Nerdbank.GitVersioning.sln`" /m /verbosity:minimal /nologo"
18+
$msbuildCommandLine = "msbuild `"$PSScriptRoot\src\Nerdbank.GitVersioning.sln`" /m /verbosity:$MsBuildVerbosity /nologo /p:Platform=`"Any CPU`""
1519

1620
if (Test-Path "C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll") {
1721
$msbuildCommandLine += " /logger:`"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll`""

init.cmd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
powershell.exe -ExecutionPolicy bypass -Command "& '%~dpn0.ps1'" %*
1+
powershell.exe -ExecutionPolicy bypass -NoProfile -Command "& '%~dpn0.ps1'" %*

init.ps1

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ Restores all NuGet, NPM and Typings packages necessary to build this repository.
66
Param(
77
)
88

9+
$oldPlatform=$env:Platform
10+
$env:Platform='AnyCPU' # Some people wander in here from a platform-specific build window.
11+
912
Push-Location $PSScriptRoot
1013
try {
1114
$toolsPath = "$PSScriptRoot\tools"
@@ -38,5 +41,6 @@ catch {
3841
exit $lastexitcode
3942
}
4043
finally {
44+
$env:Platform=$oldPlatform
4145
Pop-Location
4246
}

0 commit comments

Comments
 (0)