@@ -41,13 +41,12 @@ if (Test-Path $csvArtifacts) {
4141}
4242$null = New-Item - ItemType Directory - Path $csvArtifacts - Force
4343
44- # Clean previous builds
44+ # Clean previous builds (including obj folder to clear cached pack settings)
4545Write-Host " Cleaning previous builds..." - ForegroundColor Yellow
46- Push-Location $csvProjectPath
47- try {
48- dotnet clean - c Release -- nologo 2> $null
49- } catch { }
50- Pop-Location
46+ $cleanBinPath = Join-Path $csvProjectPath " bin"
47+ $cleanObjPath = Join-Path $csvProjectPath " obj"
48+ if (Test-Path $cleanBinPath ) { Remove-Item $cleanBinPath - Recurse - Force }
49+ if (Test-Path $cleanObjPath ) { Remove-Item $cleanObjPath - Recurse - Force }
5150
5251# Build first (without packing) so we can sign the DLLs
5352Write-Host " Building project..." - ForegroundColor Yellow
@@ -103,18 +102,17 @@ try {
103102 Pop-Location
104103}
105104
106- # Find the generated packages
105+ # Find the generated package (no snupkg - we use embedded PDBs)
107106$nupkg = Get-ChildItem - Path $csvArtifacts - Filter " *.nupkg" | Select-Object - First 1
108- $snupkg = Get-ChildItem - Path $csvArtifacts - Filter " *.snupkg" | Select-Object - First 1
109107
110108if (-not $nupkg ) {
111109 throw " No .nupkg file found in $csvArtifacts "
112110}
113111
112+ # Remove any snupkg that might have been generated (shouldn't happen with current settings)
113+ Get-ChildItem - Path $csvArtifacts - Filter " *.snupkg" | Remove-Item - Force
114+
114115Write-Host " Package created: $ ( $nupkg.Name ) " - ForegroundColor Green
115- if ($snupkg ) {
116- Write-Host " Symbols package: $ ( $snupkg.Name ) " - ForegroundColor Green
117- }
118116
119117# Publish to NuGet if requested
120118if ($Publish ) {
@@ -130,10 +128,6 @@ if ($Publish) {
130128
131129 dotnet nuget push $nupkg.FullName -- api- key $NuGetApiKey -- source https:// api.nuget.org/ v3/ index.json -- skip-duplicate
132130
133- if ($snupkg ) {
134- dotnet nuget push $snupkg.FullName -- api- key $NuGetApiKey -- source https:// api.nuget.org/ v3/ index.json -- skip-duplicate
135- }
136-
137131 if ($LASTEXITCODE -eq 0 ) {
138132 Write-Host " Published to NuGet!" - ForegroundColor Green
139133 }
0 commit comments