10
10
$ErrorActionPreference = " Stop"
11
11
12
12
$solutionFile = " src/Imageflow.dnfull.sln"
13
- $testProject1 = " tests/Imageflow.TestDotNetFull/Imageflow.TestDotNetFull.csproj "
13
+
14
14
15
15
# --- Helper function to find MSBuild ---
16
16
function Get-MSBuildPath {
@@ -44,7 +44,17 @@ function Get-MSBuildPath {
44
44
$finalExitCode = 0
45
45
# --- Build Steps ---
46
46
47
- Write-Host " Step 1: Restoring NuGet packages for the solution..."
47
+ Write-Host " Step 0: Cleaning up previous builds and caches..."
48
+ try {
49
+ dotnet clean $solutionFile -- configuration Release
50
+ dotnet nuget locals all -- clear
51
+ Write-Host " Cleanup successful."
52
+ } catch {
53
+ Write-Warning " Cleanup step failed. This might not affect the build, but it's not a clean run. $_ "
54
+ # We don't exit here, as it might not be critical
55
+ }
56
+
57
+ Write-Host " Step 1: Restoring NuGet packages for the solution (dotnet restore)..."
48
58
try {
49
59
# Restore all projects in the solution, this should handle SDK projects correctly.
50
60
dotnet restore $solutionFile -- force- evaluate
@@ -55,10 +65,10 @@ try {
55
65
}
56
66
57
67
58
- Write-Host " Step 2: Restoring NuGet packages for the legacy packages.config project (using nuget.exe)..."
68
+ Write-Host " Step 2: Restoring NuGet packages for the solution ( nuget.exe)..."
59
69
try {
60
- # This is required for the legacy project that uses packages.config
61
- nuget restore $testProject1 - SolutionDirectory src
70
+ # This is required for legacy projects that use packages.config
71
+ nuget restore $solutionFile
62
72
Write-Host " NuGet restore for legacy project completed successfully."
63
73
} catch {
64
74
Write-Error " NuGet restore failed. $_ "
0 commit comments