@@ -165,29 +165,33 @@ function Start-ScriptAnalyzerBuild
165
165
$foundVersion = Get-InstalledCLIVersion
166
166
Write-Warning " No suitable dotnet CLI found, requires version '$requiredVersion ' found only '$foundVersion '"
167
167
}
168
+ $verboseWanted = $false
169
+ if ( $PSBoundParameters [' Verbose' ] ) {
170
+ $verboseWanted = $PSBoundParameters [' Verbose' ].ToBool()
171
+ }
168
172
}
169
173
END {
170
174
171
175
# Build docs either when -Documentation switch is being specified or the first time in a clean repo
172
176
$documentationFileExists = Test-Path (Join-Path $PSScriptRoot ' out\PSScriptAnalyzer\en-us\Microsoft.Windows.PowerShell.ScriptAnalyzer.dll-Help.xml' )
173
177
if ( $Documentation -or -not $documentationFileExists )
174
178
{
175
- Write-Verbose - Verbose:$Verbose - Message " Start-DocumentationBuild"
176
- Start-DocumentationBuild
179
+ Write-Verbose - Verbose:$verboseWanted - Message " Start-DocumentationBuild"
180
+ Start-DocumentationBuild - Verbose: $verboseWanted
177
181
}
178
182
179
183
if ( $All )
180
184
{
181
185
# Build all the versions of the analyzer
182
186
foreach ($psVersion in 3 .. 7 ) {
183
- Start-ScriptAnalyzerBuild - Configuration $Configuration - PSVersion $psVersion - Verbose:$Verbose
187
+ Start-ScriptAnalyzerBuild - Configuration $Configuration - PSVersion $psVersion - Verbose:$verboseWanted
184
188
}
185
189
return
186
190
}
187
191
188
192
if (-not $profilesCopied )
189
193
{
190
- Write-Verbose - Verbose:$Verbose - Message " Copy-CompatibilityProfiles"
194
+ Write-Verbose - Verbose:$verboseWanted - Message " Copy-CompatibilityProfiles"
191
195
Copy-CompatibilityProfiles
192
196
# Set the variable in the caller's scope, so this will only happen once
193
197
Set-Variable - Name profilesCopied - Value $true - Scope 1
@@ -258,7 +262,7 @@ function Start-ScriptAnalyzerBuild
258
262
try {
259
263
Push-Location $projectRoot / Rules
260
264
$message = " Building ScriptAnalyzer for PSVersion '$PSVersion ' using framework '$framework ' and configuration '$Configuration '"
261
- Write-Verbose - Verbose:$Verbose - Message " $message "
265
+ Write-Verbose - Verbose:$verboseWanted - Message " $message "
262
266
Write-Progress " $message "
263
267
if ( -not $script :DotnetExe ) {
264
268
$script :DotnetExe = Get-DotnetExe
@@ -275,7 +279,7 @@ function Start-ScriptAnalyzerBuild
275
279
# $buildOutput = & $script:DotnetExe build --framework $framework --configuration "$buildConfiguration" 2>&1
276
280
$buildOutput = & $script :DotnetExe $dotnetArgs 2>&1
277
281
if ( $LASTEXITCODE -ne 0 ) { throw " $buildOutput " }
278
- Write-Verbose - Verbose:$Verbose - message " $buildOutput "
282
+ Write-Verbose - Verbose:$verboseWanted - message " $buildOutput "
279
283
}
280
284
catch {
281
285
Write-Warning $_
0 commit comments