Skip to content

Commit 7bfbaf7

Browse files
Fix build script output paths resolution
1 parent 4f02755 commit 7bfbaf7

File tree

1 file changed

+24
-8
lines changed

1 file changed

+24
-8
lines changed

build.ps1

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,7 @@ function Build-Net-Core($outPath) {
5757

5858
function Create-Package-Structure($basePath, $targets) {
5959

60-
Remove-Item $basePath -Force -Recurse -ErrorAction SilentlyContinue
61-
New-Item -ItemType directory $basePath
60+
Cleanup-Folder $basePath
6261

6362
ForEach ($target in $targets.GetEnumerator())
6463
{
@@ -75,12 +74,29 @@ function Create-Package {
7574
if (-not $?) { exit 1 }
7675
}
7776

78-
Write-Host "Building cloudinary net classic library..."
79-
$outBuildPath = "{0}{1}" -f "..\", $netClassicPath
80-
Build-Net-Classic $outBuildPath
81-
Write-Host "Building cloudinary net core library..."
82-
$outBuildPath = "{0}{1}" -f "..\", $netCorePath
83-
Build-Net-Core $outBuildPath
77+
function Cleanup-Folder ($folder) {
78+
if (Test-Path -Path "$folder") {
79+
Write-Host "Cleaning up folder: $folder"
80+
Remove-Item "$folder\*" -Force -Recurse
81+
} else {
82+
Write-Host "Folder: $folder does not exist, creating"
83+
New-Item -ItemType directory $folder
84+
}
85+
}
86+
87+
88+
Cleanup-Folder $baseOutputPath
89+
Cleanup-Folder $netClassicPath
90+
91+
$netClassicPath = Resolve-Path -Path $netClassicPath
92+
Write-Host "Building Cloudinary .NET Classic library to: $netClassicPath"
93+
Build-Net-Classic $netClassicPath
94+
95+
Cleanup-Folder $netCorePath
96+
97+
$netCorePath = Resolve-Path -Path $netCorePath
98+
Write-Host "Building Cloudinary .NET Core library to: $netCorePath"
99+
Build-Net-Core $netCorePath
84100

85101
Create-Package-Structure $libPath $targetFrameworks
86102
Create-Package

0 commit comments

Comments
 (0)