11param (
22 [switch ]$Debug ,
3- [string ]$VisualStudioVersion = ' 14 .0' ,
3+ [string ]$VisualStudioVersion = ' 15 .0' ,
44 [switch ]$SkipKeyCheck ,
5- [string ]$Verbosity = ' normal' ,
6- [string ]$Logger
5+ [string ]$Verbosity = ' minimal' ,
6+ [string ]$Logger ,
7+ [switch ]$Incremental
78)
89
910# build the solution
@@ -45,7 +46,12 @@ If (-not (Test-Path $nuget)) {
4546}
4647
4748# build the main project
48- $msbuild = " ${env: ProgramFiles(x86)} \MSBuild\$VisualStudioVersion \Bin\MSBuild.exe"
49+ $visualStudio = (Get-ItemProperty ' HKLM:\SOFTWARE\WOW6432Node\Microsoft\VisualStudio\SxS\VS7' )." $VisualStudioVersion "
50+ $msbuild = " $visualStudio \MSBuild\$VisualStudioVersion \Bin\MSBuild.exe"
51+ If (-not (Test-Path $msbuild )) {
52+ $host.UI.WriteErrorLine (" Couldn't find MSBuild.exe" )
53+ exit 1
54+ }
4955
5056# Attempt to restore packages up to 3 times, to improve resiliency to connection timeouts and access denied errors.
5157$maxAttempts = 3
@@ -63,12 +69,23 @@ If ($Logger) {
6369 $LoggerArgument = " /logger:$Logger "
6470}
6571
66- & $msbuild ' /nologo' ' /m' ' /nr:false' ' /t:rebuild' $LoggerArgument " /verbosity:$Verbosity " " /p:Configuration=$BuildConfig " " /p:VisualStudioVersion=$VisualStudioVersion " " /p:KeyConfiguration=$KeyConfiguration " $SolutionPath
72+ If ($Incremental ) {
73+ $Target = ' build'
74+ } Else {
75+ $Target = ' rebuild'
76+ }
77+
78+ & $msbuild ' /nologo' ' /m' ' /nr:false' " /t:$Target " $LoggerArgument " /verbosity:$Verbosity " " /p:Configuration=$BuildConfig " " /p:VisualStudioVersion=$VisualStudioVersion " " /p:KeyConfiguration=$KeyConfiguration " $SolutionPath
6779If (-not $? ) {
6880 $host.ui.WriteErrorLine (' Build failed, aborting!' )
6981 exit $LASTEXITCODE
7082}
7183
84+ if ($Incremental ) {
85+ # Skip NuGet validation and copying packages to the output directory
86+ exit 0
87+ }
88+
7289# By default, do not create a NuGet package unless the expected strong name key files were used
7390if (-not $SkipKeyCheck ) {
7491 . .\keys.ps1
0 commit comments