Skip to content

Commit dba6bf3

Browse files
committed
Fix CI: use dotnet msbuild with VS extensions path for PRI tasks
1 parent ee6dc8b commit dba6bf3

1 file changed

Lines changed: 18 additions & 9 deletions

File tree

.github/workflows/release.yml

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -51,17 +51,26 @@ jobs:
5151
5252
- name: Restore & Build WinAppSdk library
5353
shell: pwsh
54-
env:
55-
# Let VS MSBuild find the .NET 10 SDK installed by setup-dotnet
56-
DOTNET_HOST_PATH: ${{ env.DOTNET_ROOT }}\dotnet.exe
5754
run: |
58-
# Restore with dotnet (guaranteed to have .NET 10 SDK)
55+
# Use dotnet msbuild (has .NET 10 SDK) but point it to VS's AppxPackage targets for PRI generation
56+
$vsPath = "${{ steps.vs.outputs.VS_PATH }}"
57+
58+
# Find the VS MSBuild extensions path containing the AppxPackage/PRI targets
59+
$vsVersion = (Get-ChildItem "$vsPath\MSBuild\Microsoft\VisualStudio" -Directory | Sort-Object Name -Descending | Select-Object -First 1).Name
60+
$appxPath = "$vsPath\MSBuild\Microsoft\VisualStudio\$vsVersion\AppxPackage"
61+
Write-Host "VS Version: $vsVersion"
62+
Write-Host "AppxPackage path: $appxPath"
63+
Write-Host "Exists: $(Test-Path $appxPath)"
64+
65+
# Set the environment variable that WinAppSDK PRI targets use
66+
$env:MSBuildExtensionsPath = "$vsPath\MSBuild"
67+
$env:VSInstallDir = "$vsPath\"
68+
5969
dotnet restore src/CompositionCollectionView.WinAppSdk/CompositionCollectionView.WinAppSdk.csproj -p:Platform=x64
60-
# Build with VS MSBuild (has PRI tools) using dotnet SDK's .NET 10 targets
61-
& "${{ steps.vs.outputs.MSBUILD }}" src/CompositionCollectionView.WinAppSdk/CompositionCollectionView.WinAppSdk.csproj `
62-
/t:Build /p:Configuration=Release /p:Platform=x64 `
63-
"/p:DotNetRoot=$env:DOTNET_ROOT\" `
64-
"/p:NetCoreTargetingPackRoot=$env:DOTNET_ROOT\packs"
70+
dotnet build src/CompositionCollectionView.WinAppSdk/CompositionCollectionView.WinAppSdk.csproj `
71+
-c Release `
72+
--no-restore `
73+
-p:Platform=x64
6574
6675
- name: Pack NuGet
6776
shell: pwsh

0 commit comments

Comments
 (0)