Skip to content

Commit 2f21b6a

Browse files
committed
Try nuget restore on full solution instead.
1 parent a123d4b commit 2f21b6a

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

.github/workflows/dotnet-core.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ jobs:
155155
if: matrix.test_legacy
156156
run: |
157157
dotnet restore ${{ env.FULL_SLN }}
158-
nuget restore tests/Imageflow.TestDotNetFull/Imageflow.TestDotNetFull.csproj -SolutionDirectory src
158+
nuget restore ${{ env.FULL_SLN }}
159159
msbuild ${{ env.FULL_SLN }} /p:Configuration=Release /p:Platform="Any CPU"
160160
161161
- name: Legacy - Test Imageflow.TestDotNetFull and Imageflow.TestDotNetFullPackageReference

test_legacy_dotnet.ps1

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
$ErrorActionPreference = "Stop"
1111

1212
$solutionFile = "src/Imageflow.dnfull.sln"
13-
$testProject1 = "tests/Imageflow.TestDotNetFull/Imageflow.TestDotNetFull.csproj"
13+
1414

1515
# --- Helper function to find MSBuild ---
1616
function Get-MSBuildPath {
@@ -44,7 +44,17 @@ function Get-MSBuildPath {
4444
$finalExitCode = 0
4545
# --- Build Steps ---
4646

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)..."
4858
try {
4959
# Restore all projects in the solution, this should handle SDK projects correctly.
5060
dotnet restore $solutionFile --force-evaluate
@@ -55,10 +65,10 @@ try {
5565
}
5666

5767

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)..."
5969
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
6272
Write-Host "NuGet restore for legacy project completed successfully."
6373
} catch {
6474
Write-Error "NuGet restore failed. $_"

0 commit comments

Comments
 (0)