saving 10.23 ps1
MODIFY
src/Chapter10/Listing10.23.RegisteringAFinalizerWithProcessExit.ps1
src/Chapter10/Listing10.23.RegisteringAFinalizerWithProcessExit.ps1
@@ -18,7 +18,7 @@ if('traceLevel' -notin $PSBoundParameters.Keys) {
$ConsoleProgramProjectName = 'ProcessExitTestProgram'
try {
- Get-Item "$PSScriptRoot\$LibraryProjectName","$PSScriptRoot\$ConsoleProgramProjectName" -ErrorAction Ignore | Remove-Item -Recurse
+ Get-Item "$PSScriptRoot\$ConsoleProgramProjectName" -ErrorAction Ignore | Remove-Item -Recurse
Set-PSDebug -Trace $traceLevel
dotnet new Console --output "$ConsoleProgramProjectName"
#dotnet new ClassLib --langVersion '8.0' --output "$LibraryProjectName"
@@ -27,14 +27,14 @@ try {
$SutCSFile = "$PSScriptRoot\$([IO.Path]::GetFileNameWithoutExtension($SutCSFile)).cs"
if(-not (Test-Path $SutCSFile)) { throw "Unable to fine the file with the type to export ('$SutCSFile')"}
#New-Item -ItemType Directory "$PSScriptRoot\$LibraryProjectName"
- $codeListing = @('namespace ProcessExit') + (
+ $codeListing = @('namespace ProcessExitTestProgram') + (
Get-Content $SutCSFile |
Select-Object -Skip 1)
$codeListing > "$PSScriptRoot\$ConsoleProgramProjectName\GeoTypes.cs"
- Get-Content "$PSScriptRoot\$LibraryProjectName\GeoTypes.cs" # Display the listing
- dotnet add "$PSScriptRoot\$ConsoleProgramProjectName\$ConsoleProgramProjectName.csproj" reference "$PSScriptRoot\$LibraryProjectName\$LibraryProjectName.csproj"
+ Get-Content "$PSScriptRoot\$ConsoleProgramProjectName\GeoTypes.cs" # Display the listing
+ #dotnet add "$PSScriptRoot\$ConsoleProgramProjectName\$ConsoleProgramProjectName.csproj"
- dotnet run -p "$PSScriptRoot\$ConsoleProgramProjectName\$ConsoleProgramProjectName.csproj"
+ dotnet run -p "$PSScriptRoot\$ConsoleProgramProjectName.csproj"
}
finally {

saving 10.23 ps1