Skip to content

Commit 59bc922

Browse files
Build lib/ compile reference as AnyCPU MSIL (v0.1.5)
Adds AnyCPU to the Platforms list of both .WinAppSdk csprojs and points the lib\net10.0-windows10.0.19041.0 entries in both nuspecs at the AnyCPU build output (bin\Release\, by SDK convention). The per-arch runtimes\win-x64\ and runtimes\win-arm64\ payloads are kept as-is so actual runtime behavior is unchanged. Eliminates MSB3270 / CS8012 warnings in consumer projects that build for ARM64 (or any platform other than x64) and reference these packages. Verified by overlaying the AnyCPU DLLs onto a consumer's package cache and rebuilding -- warning count drops from N to 0. CI workflow gets a new AnyCPU build step before the x64 / ARM64 builds so nuget pack finds the MSIL DLL at bin\Release\. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent ecd29c5 commit 59bc922

5 files changed

Lines changed: 39 additions & 10 deletions

File tree

.github/workflows/release.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,19 @@ jobs:
7272
Write-Host "PRI DLL exists: $(Test-Path "$appxPath\Microsoft.Build.Packaging.Pri.Tasks.dll")"
7373
"APPX_PATH=$appxPath" >> $env:GITHUB_OUTPUT
7474
75+
- name: Restore & Build WinAppSdk library (AnyCPU - for lib/ compile ref)
76+
shell: pwsh
77+
run: |
78+
# AnyCPU produces an MSIL (Machine=Intel-386, IL-only) binary that
79+
# both nuspecs use as the compile-time reference under lib/net10.0,
80+
# so consumers building for x64/ARM64 don't see MSB3270/CS8012.
81+
dotnet restore src/CompositionCollectionView.WinAppSdk/CompositionCollectionView.WinAppSdk.csproj -p:Platform=AnyCPU
82+
dotnet build src/CompositionCollectionView.WinAppSdk/CompositionCollectionView.WinAppSdk.csproj `
83+
-c Release `
84+
--no-restore `
85+
-p:Platform=AnyCPU `
86+
"-p:AppxMSBuildToolsPath=${{ steps.appx.outputs.APPX_PATH }}\"
87+
7588
- name: Restore & Build WinAppSdk library (x64)
7689
shell: pwsh
7790
run: |

CompositionCollectionView.nuspec

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,15 @@
2929
<file src="src\CompositionCollectionView\bin\Release\CompositionCollectionView.pri" target="lib\uap10.0.19041" />
3030
<file src="src\CompositionCollectionView\bin\Release\CompositionCollectionView\**" target="lib\uap10.0.19041\CompositionCollectionView" />
3131

32-
<!-- WinUI 3 / Windows App SDK – compile reference + resources (net10.0-windows10.0.19041.0) -->
33-
<file src="src\CompositionCollectionView.WinAppSdk\bin\x64\Release\net10.0-windows10.0.19041.0\CompositionCollectionView.dll" target="lib\net10.0-windows10.0.19041.0" />
34-
<file src="src\CompositionCollectionView.WinAppSdk\bin\x64\Release\net10.0-windows10.0.19041.0\CompositionCollectionView.xml" target="lib\net10.0-windows10.0.19041.0" />
35-
<file src="src\CompositionCollectionView.WinAppSdk\bin\x64\Release\net10.0-windows10.0.19041.0\CompositionCollectionView.pri" target="lib\net10.0-windows10.0.19041.0" />
36-
<file src="src\CompositionCollectionView.WinAppSdk\bin\x64\Release\net10.0-windows10.0.19041.0\CompositionCollectionView\**" target="lib\net10.0-windows10.0.19041.0\CompositionCollectionView" />
32+
<!-- WinUI 3 / Windows App SDK – compile reference + resources (net10.0-windows10.0.19041.0)
33+
Sourced from the AnyCPU (MSIL) build so consumers targeting any
34+
processor architecture don't get MSB3270/CS8012 warnings. AnyCPU
35+
builds collapse `bin\AnyCPU\` to plain `bin\` by SDK convention.
36+
The per-arch runtime payloads below are still architecture-specific. -->
37+
<file src="src\CompositionCollectionView.WinAppSdk\bin\Release\net10.0-windows10.0.19041.0\CompositionCollectionView.dll" target="lib\net10.0-windows10.0.19041.0" />
38+
<file src="src\CompositionCollectionView.WinAppSdk\bin\Release\net10.0-windows10.0.19041.0\CompositionCollectionView.xml" target="lib\net10.0-windows10.0.19041.0" />
39+
<file src="src\CompositionCollectionView.WinAppSdk\bin\Release\net10.0-windows10.0.19041.0\CompositionCollectionView.pri" target="lib\net10.0-windows10.0.19041.0" />
40+
<file src="src\CompositionCollectionView.WinAppSdk\bin\Release\net10.0-windows10.0.19041.0\CompositionCollectionView\**" target="lib\net10.0-windows10.0.19041.0\CompositionCollectionView" />
3741

3842
<!-- WinUI 3 / Windows App SDK – x64 runtime -->
3943
<file src="src\CompositionCollectionView.WinAppSdk\bin\x64\Release\net10.0-windows10.0.19041.0\CompositionCollectionView.dll" target="runtimes\win-x64\lib\net10.0-windows10.0.19041.0" />

CompositionExpressions.nuspec

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,13 @@
2727
the .xml below. -->
2828
<file src="src\CompositionExpressions\bin\Release\CompositionExpressions.dll" target="lib\uap10.0.19041" />
2929

30-
<!-- WinUI 3 / Windows App SDK – compile reference (net10.0-windows10.0.19041.0) -->
31-
<file src="src\CompositionExpressions.WinAppSdk\bin\x64\Release\net10.0-windows10.0.19041.0\CompositionExpressions.dll" target="lib\net10.0-windows10.0.19041.0" />
32-
<file src="src\CompositionExpressions.WinAppSdk\bin\x64\Release\net10.0-windows10.0.19041.0\CompositionExpressions.xml" target="lib\net10.0-windows10.0.19041.0" />
30+
<!-- WinUI 3 / Windows App SDK – compile reference (net10.0-windows10.0.19041.0)
31+
Sourced from the AnyCPU (MSIL) build so consumers targeting any
32+
processor architecture don't get MSB3270/CS8012 warnings. AnyCPU
33+
builds collapse `bin\AnyCPU\` to plain `bin\` by SDK convention.
34+
The per-arch runtime payloads below are still architecture-specific. -->
35+
<file src="src\CompositionExpressions.WinAppSdk\bin\Release\net10.0-windows10.0.19041.0\CompositionExpressions.dll" target="lib\net10.0-windows10.0.19041.0" />
36+
<file src="src\CompositionExpressions.WinAppSdk\bin\Release\net10.0-windows10.0.19041.0\CompositionExpressions.xml" target="lib\net10.0-windows10.0.19041.0" />
3337

3438
<!-- WinUI 3 / Windows App SDK – x64 runtime -->
3539
<file src="src\CompositionExpressions.WinAppSdk\bin\x64\Release\net10.0-windows10.0.19041.0\CompositionExpressions.dll" target="runtimes\win-x64\lib\net10.0-windows10.0.19041.0" />

src/CompositionCollectionView.WinAppSdk/CompositionCollectionView.WinAppSdk.csproj

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,11 @@
1111
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
1212
<ImplicitUsings>enable</ImplicitUsings>
1313
<UseWinUI>true</UseWinUI>
14-
<Platforms>x86;x64;ARM64</Platforms>
14+
<!-- AnyCPU is added so the nuspec's lib\net10.0 compile-time reference can
15+
be sourced from an AnyCPU (MSIL) build, avoiding MSB3270/CS8012
16+
warnings in consumers that target a different architecture. The
17+
per-arch runtimes\win-* payloads remain platform-specific. -->
18+
<Platforms>AnyCPU;x86;x64;ARM64</Platforms>
1519
<RuntimeIdentifiers>win-x86;win-x64;win-arm64</RuntimeIdentifiers>
1620
<DefineConstants>$(DefineConstants);WINAPPSDK</DefineConstants>
1721
<GenerateDocumentationFile>true</GenerateDocumentationFile>

src/CompositionExpressions.WinAppSdk/CompositionExpressions.WinAppSdk.csproj

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,11 @@
1010
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
1111
<ImplicitUsings>enable</ImplicitUsings>
1212
<UseWinUI>false</UseWinUI>
13-
<Platforms>x86;x64;ARM64</Platforms>
13+
<!-- AnyCPU is added so the nuspec's lib\net10.0 compile-time reference can
14+
be sourced from an AnyCPU (MSIL) build, avoiding MSB3270/CS8012
15+
warnings in consumers that target a different architecture. The
16+
per-arch runtimes\win-* payloads remain platform-specific. -->
17+
<Platforms>AnyCPU;x86;x64;ARM64</Platforms>
1418
<RuntimeIdentifiers>win-x86;win-x64;win-arm64</RuntimeIdentifiers>
1519
<DefineConstants>$(DefineConstants);WINAPPSDK</DefineConstants>
1620
<GenerateDocumentationFile>true</GenerateDocumentationFile>

0 commit comments

Comments
 (0)