Skip to content

Commit e3539f6

Browse files
Improve build script cleanup and package handling
Replaces 'dotnet clean' with explicit removal of bin and obj folders to ensure cached pack settings are cleared. Removes handling of snupkg files, as only embedded PDBs are used, and ensures any generated snupkg files are deleted.
1 parent 522637c commit e3539f6

2 files changed

Lines changed: 12 additions & 17 deletions

File tree

build/build-csv.ps1

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -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)
4545
Write-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
5352
Write-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

110108
if (-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+
114115
Write-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
120118
if ($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
}

project/Dataplat.Dbatools.Csv/Dataplat.Dbatools.Csv.csproj

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
<!-- NuGet Package Metadata -->
99
<PackageId>Dataplat.Dbatools.Csv</PackageId>
10-
<Version>1.0.0</Version>
10+
<Version>1.0.2</Version>
1111
<Authors>Chrissy LeMaire</Authors>
1212
<Company>Dataplat</Company>
1313
<Product>Dataplat.Dbatools.Csv</Product>
@@ -24,6 +24,7 @@
2424
<PublishRepositoryUrl>true</PublishRepositoryUrl>
2525
<EmbedUntrackedSources>true</EmbedUntrackedSources>
2626
<IncludeSymbols>false</IncludeSymbols>
27+
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
2728

2829
<!-- Build settings -->
2930
<GenerateDocumentationFile>true</GenerateDocumentationFile>
@@ -33,7 +34,7 @@
3334
</PropertyGroup>
3435

3536
<PropertyGroup Condition="'$(Configuration)' == 'Release'">
36-
<DebugType>embedded</DebugType>
37+
<DebugType>portable</DebugType>
3738
<Optimize>true</Optimize>
3839
</PropertyGroup>
3940

0 commit comments

Comments
 (0)