@@ -308,7 +308,10 @@ function New-Catalog
308308function Test-ScriptAnalyzer
309309{
310310 [CmdletBinding ()]
311- param ( [switch ] $InProcess )
311+ param (
312+ [switch ] $InProcess ,
313+ [string ] $WithPowerShell
314+ )
312315
313316 END {
314317 # versions 3 and 4 don't understand versioned module paths, so we need to rename the directory of the version to
@@ -347,11 +350,19 @@ function Test-ScriptAnalyzer
347350 $analyzerPsd1Path = Join-Path - Path $script :destinationDir - ChildPath " $analyzerName .psd1"
348351 $scriptBlock = [scriptblock ]::Create(" Import-Module '$analyzerPsd1Path '; Invoke-Pester -Path $testScripts -CI" )
349352 if ( $InProcess ) {
353+ Write-Verbose " Testing with PowerShell $ ( $PSVersionTable.PSVersion ) "
350354 & $scriptBlock
351355 }
356+ elseif ( $WithPowerShell ) {
357+ $pwshVersion = & $WithPowerShell -- version
358+ Write-Verbose " Testing with $pwshVersion "
359+ & $WithPowerShell - Command $scriptBlock
360+ }
352361 else {
353362 $powershell = (Get-Process - id $PID ).MainModule.FileName
354- & ${powershell} - NoProfile - Command $scriptBlock
363+ $pwshVersion = & $powershell -- version
364+ Write-Verbose " Testing with $pwshVersion "
365+ & $powershell - NoProfile - Command $scriptBlock
355366 }
356367 }
357368 finally {
@@ -555,6 +566,13 @@ function Get-DotnetExe
555566 $script :DotnetExe = $dotnetHuntPath
556567 return $dotnetHuntPath
557568 }
569+
570+ $dotnetHuntPath = " C:\Program Files\dotnet\dotnet.exe"
571+ Write-Verbose - Verbose " checking Windows $dotnetHuntPath "
572+ if ( test-path $dotnetHuntPath ) {
573+ $script :DotnetExe = $dotnetHuntPath
574+ return $dotnetHuntPath
575+ }
558576 }
559577 else {
560578 $dotnetHuntPath = " $HOME /.dotnet/dotnet"
0 commit comments