Switch \ to /
MODIFY
src/Chapter10/Listing10.23.RegisteringAFinalizerWithProcessExit.ps1
src/Chapter10/Listing10.23.RegisteringAFinalizerWithProcessExit.ps1
@@ -20,19 +20,19 @@ $ConsoleProgramProjectName = 'ProcessExitTestProgram'
if($testStatus -eq "create"){
try {
- Get-Item "$PSScriptRoot\$ConsoleProgramProjectName" -ErrorAction Ignore | Remove-Item -Recurse
+ Get-Item "$PSScriptRoot/$ConsoleProgramProjectName" -ErrorAction Ignore | Remove-Item -Recurse
Set-PSDebug -Trace $traceLevel
- dotnet new Console --output "$PSScriptRoot\$ConsoleProgramProjectName"
+ dotnet new Console --output "$PSScriptRoot/$ConsoleProgramProjectName"
$SutCSFile = split-path -leaf $MyInvocation.MyCommand.Definition
- $SutCSFile = "$PSScriptRoot\$([IO.Path]::GetFileNameWithoutExtension($SutCSFile)).cs"
+ $SutCSFile = "$PSScriptRoot/$([IO.Path]::GetFileNameWithoutExtension($SutCSFile)).cs"
if(-not (Test-Path $SutCSFile)) { throw "Unable to fine the file with the type to export ('$SutCSFile')"}
$codeListing = @('namespace ProcessExitTestProgram') + (
Get-Content $SutCSFile |
Select-Object -Skip 1)
- $codeListing > "$PSScriptRoot\$ConsoleProgramProjectName\Program.cs"
- Get-Content "$PSScriptRoot\$ConsoleProgramProjectName\Program.cs" # Display the listing
+ $codeListing > "$PSScriptRoot/$ConsoleProgramProjectName/Program.cs"
+ Get-Content "$PSScriptRoot/$ConsoleProgramProjectName/Program.cs" # Display the listing
}catch{
@@ -42,19 +42,19 @@ try {
}
if($testStatus -eq "cleanup"){
- Get-Item "$PSScriptRoot\$ConsoleProgramProjectName" -ErrorAction Ignore | Remove-Item -Recurse
+ Get-Item "$PSScriptRoot/$ConsoleProgramProjectName" -ErrorAction Ignore | Remove-Item -Recurse
}
if($testStatus -eq "run"){
try{
if($finalizerOption -eq 'dispose'){
- dotnet run --project "$PSScriptRoot\$ConsoleProgramProjectName\$ConsoleProgramProjectName.csproj" -- -dispose
+ dotnet run --project "$PSScriptRoot/$ConsoleProgramProjectName/$ConsoleProgramProjectName.csproj" -- -dispose
}
elseif($finalizerOption -eq 'gc'){
- dotnet run --project "$PSScriptRoot\$ConsoleProgramProjectName\$ConsoleProgramProjectName.csproj" -- -gc
+ dotnet run --project "$PSScriptRoot/$ConsoleProgramProjectName/$ConsoleProgramProjectName.csproj" -- -gc
}
elseif($finalizerOption -eq 'processExit'){
- dotnet run --project "$PSScriptRoot\$ConsoleProgramProjectName\$ConsoleProgramProjectName.csproj"
+ dotnet run --project "$PSScriptRoot/$ConsoleProgramProjectName/$ConsoleProgramProjectName.csproj"
}
else{
Write-Error "finalizerOption: $finalizerOption not valid with the testStatus: run"

Switch \ to /