From 55d3e6d0f37454b545672b935681a166a4c38d46 Mon Sep 17 00:00:00 2001 From: Chaim Date: Mon, 11 May 2026 16:04:00 +0000 Subject: [PATCH] fix(ci): unify restore + build via 'msbuild /restore' (avoid NETSDK1064) Standalone 'nuget.exe restore' (32-bit) and the subsequent build (which loads the 64-bit .NET 9 SDK PackageDependencyResolution.targets) disagree on the resolved package paths, surfacing as NETSDK1064 'Package ... was not found' on SDK-style projects (OutlookAddin.UI / .Core / .Tests). Using 'msbuild /restore' keeps both phases in one MSBuild process with a consistent assets file and package cache lookup. Co-Authored-By: Claude Opus 4.7 (1M context) --- .gitea/workflows/build.yml | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml index 47e223e..30b9bb3 100644 --- a/.gitea/workflows/build.yml +++ b/.gitea/workflows/build.yml @@ -33,14 +33,12 @@ jobs: Write-Host "Using MSBuild from $msbuildDir" Add-Content -Path $env:GITHUB_PATH -Value $msbuildDir - - name: Setup NuGet - uses: nuget/setup-nuget@v2 - - - name: Restore NuGet - run: nuget restore OutlookAddin.sln - - - name: Build - run: msbuild OutlookAddin.sln /t:Build /p:Configuration=Release /p:Platform="Any CPU" /m + - name: Build (restore + compile) + # `msbuild /restore` runs restore and build in the same MSBuild process, + # which keeps the NuGet package cache + project.assets.json + assembly + # resolution consistent (avoids NETSDK1064 from a mismatch between a + # standalone `nuget restore` and the later build). + run: msbuild OutlookAddin.sln /restore /t:Build /p:Configuration=Release /p:Platform="Any CPU" /m - name: Test run: dotnet test src/OutlookAddin.Tests/OutlookAddin.Tests.csproj --configuration Release --no-build --logger "trx;LogFileName=test-results.trx" @@ -68,9 +66,6 @@ jobs: if (-not $installPath) { throw "No VS installation with the Office workload found on this runner." } Add-Content -Path $env:GITHUB_PATH -Value (Join-Path $installPath 'MSBuild\Current\Bin') - - name: Setup NuGet - uses: nuget/setup-nuget@v2 - - name: Resolve mage.exe + signtool.exe paths id: tools shell: powershell @@ -131,11 +126,8 @@ jobs: Remove-Item -Force $tmpPfx Write-Host "Cert imported." - - name: Restore NuGet - run: nuget restore OutlookAddin.sln - - - name: Build Release - run: msbuild OutlookAddin.sln /t:Build /p:Configuration=Release /p:Platform="Any CPU" /m + - name: Build Release (restore + compile) + run: msbuild OutlookAddin.sln /restore /t:Build /p:Configuration=Release /p:Platform="Any CPU" /m # Code signing -- cert in LocalMachine\My (or CurrentUser\My); signtool # picks it by thumbprint, the service runs as LocalSystem so the runtime