Skip to content

Commit 1aa6e02

Browse files
devkanroCopilot
andauthored
Switch to AnyCPU for libraries, migrate to slnx (#187)
* Switch to AnyCPU platform with RuntimeIdentifier for native assets Replace the Platform-based architecture selection (x64/ARM64) with RuntimeIdentifier-based selection. All projects now default to AnyCPU; the correct native Windows App SDK DLLs are resolved via RuntimeIdentifier (win-x64/win-arm64) set automatically in Directory.Build.targets based on machine architecture. Changes: - Directory.Build.props: Remove Platform override that forced AnyCPU to x64/ARM64 - Directory.Build.targets: Add RuntimeIdentifier default for Windows TFM projects (net8.0+) when Platform is AnyCPU - All ~100 .csproj files: Remove <Platforms>x64;ARM64</Platforms> - Reactor.Cli: Update MirrorBinForSelfhost to resolve arch from RuntimeIdentifier (keeps bin/x64 and bin/arm64 layout) - Solution file: Update Any CPU/x86 project mappings to use Any CPU (instead of remapping to x64) - release.yml: Remove -p:Platform=x64 from build/pack (keep --runtime for publish) - coverage.yml: Replace hardcoded bin/x64 path with dynamic file lookup - Update AGENTS.md, CONTRIBUTING.md, README.md, PR template, devtools skill doc The release workflow still produces RID-specific CLI binaries (win-x64 + win-arm64) for the skill kit. The NuGet package is now architecture-neutral. Fixes #185 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Refine: libraries AnyCPU, apps keep x64/ARM64; migrate to slnx Revise the AnyCPU approach based on feedback: - Libraries (Reactor, Reactor.Interop.WinForms) explicitly set Platform=AnyCPU and Platforms=AnyCPU — they produce architecture- neutral IL. - Application/test projects keep the existing x64/ARM64 platform selection via Directory.Build.props (defaults to machine arch). - WindowsAppSDKSelfContained apps need a concrete architecture for native asset resolution; this is supplied by Platform (x64/ARM64). Also migrates from Reactor.sln to Reactor.slnx: - Cleaner XML format, no per-project platform mapping boilerplate - Solution platforms reduced to x64 and ARM64 (removed Any CPU/x86) - Library projects have no platform mappings (always AnyCPU) Remove Directory.Build.targets RuntimeIdentifier logic — no longer needed since apps use Platform directly for native assets. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Simplify: per-project Platforms, no shared Platform logic Each project declares its own platform requirements: - Application/test/sample projects: <Platforms>x64;ARM64</Platforms> (need concrete arch for WindowsAppSDKSelfContained native assets) - Library projects (Reactor, Reactor.Interop.WinForms): no Platforms (MSBuild defaults to AnyCPU; IL is always architecture-neutral) - Analyzers/generators (netstandard2.0): inherently AnyCPU Directory.Build.props no longer contains Platform fallback logic. When building a single app project directly, pass -p:Platform=x64 (or ARM64). Solution builds get Platform from the .slnx config. CI workflows now pass explicit -p:Platform=x64 for standalone project builds. Fix SelfTests: pure MSTest runner, no Windows App SDK dependency — set WindowsAppSDKSelfContained=false and remove Platforms. Fix .sln → .slnx migration: update FindHostExe() repo-root lookups in SelfTestBatch, TestSession, WinFormsTestSession, and CompileCommand to search for Reactor.slnx instead of Reactor.sln. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Remove Platforms from WPF projects (no Windows App SDK dependency) StressPerf.Wpf and CmdPerf.Wpf target net10.0-windows (no WinAppSDK), so they don't need WindowsAppSDKSelfContained and can be AnyCPU. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> * Fix slnx: remove x64/ARM64 platform mappings from AnyCPU projects PerfBench.Shared, StressPerf.Shared, StressPerf.Wpf, CmdPerf.Wpf, Chat.UI, and Reactor.SelfTests no longer declare x64/ARM64 Platforms, so their slnx entries must not map to those configurations. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent a475145 commit 1aa6e02

29 files changed

Lines changed: 387 additions & 1550 deletions

File tree

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Thanks for contributing to Reactor! A few notes before you open this PR:
44
- Link the issue or spec this PR addresses (Fixes #..., Implements docs/specs/0XX-...).
55
- Keep the change focused. Smaller, well-scoped PRs land faster.
66
- Include tests. See CONTRIBUTING.md for the unit / selftest / e2e split.
7-
- Run `dotnet build Reactor.sln -p:Platform=x64` and `dotnet test tests/Reactor.Tests` locally.
7+
- Run `dotnet build Reactor.slnx` and `dotnet test tests/Reactor.Tests` locally.
88
- First-time contributors: the Microsoft CLA bot will comment automatically; sign once and you're set.
99
-->
1010

@@ -22,7 +22,7 @@ Thanks for contributing to Reactor! A few notes before you open this PR:
2222
- [ ] Added unit tests in tests/Reactor.Tests/...
2323
- [ ] Added selftest fixture in tests/Reactor.AppTests.Host/SelfTest/Fixtures/...
2424
- [ ] Ran `dotnet test tests/Reactor.Tests`
25-
- [ ] Manually ran `dotnet run --project samples/Reactor.TestApp -p:Platform=x64`
25+
- [ ] Manually ran `dotnet run --project samples/Reactor.TestApp`
2626
-->
2727

2828
## Risk / breaking changes

.github/workflows/ci.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,10 @@ jobs:
6868
dotnet-version: 10.0.x
6969

7070
- name: Restore
71-
run: dotnet restore tests/Reactor.Tests/Reactor.Tests.csproj
71+
run: dotnet restore tests/Reactor.Tests/Reactor.Tests.csproj -p:Platform=x64
7272

7373
- name: Test
74-
run: dotnet test tests/Reactor.Tests/Reactor.Tests.csproj --no-restore --logger "console;verbosity=normal"
74+
run: dotnet test tests/Reactor.Tests/Reactor.Tests.csproj --no-restore -p:Platform=x64 --logger "console;verbosity=normal"
7575

7676
selftests:
7777
name: Selftests
@@ -87,10 +87,10 @@ jobs:
8787
dotnet-version: 10.0.x
8888

8989
- name: Restore
90-
run: dotnet restore tests/Reactor.SelfTests/Reactor.SelfTests.csproj
90+
run: dotnet restore tests/Reactor.SelfTests/Reactor.SelfTests.csproj -p:Platform=x64
9191

9292
- name: Test
93-
run: dotnet test tests/Reactor.SelfTests/Reactor.SelfTests.csproj --no-restore --logger "console;verbosity=normal"
93+
run: dotnet test tests/Reactor.SelfTests/Reactor.SelfTests.csproj --no-restore -p:Platform=x64 --logger "console;verbosity=normal"
9494

9595
build-solution:
9696
name: Build solution
@@ -106,7 +106,7 @@ jobs:
106106
dotnet-version: 10.0.x
107107

108108
- name: Restore
109-
run: dotnet restore Reactor.sln
109+
run: dotnet restore Reactor.slnx
110110

111111
- name: Build
112-
run: dotnet build Reactor.sln --no-restore --configuration Release
112+
run: dotnet build Reactor.slnx --no-restore --configuration Release

.github/workflows/coverage.yml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,30 +66,35 @@ jobs:
6666
- name: Build for instrumentation
6767
shell: pwsh
6868
run: |
69-
dotnet build tests/Reactor.Tests -c Debug -p:Optimize=false -p:DebugType=portable
69+
dotnet build tests/Reactor.Tests -c Debug -p:Platform=x64 -p:Optimize=false -p:DebugType=portable
7070
dotnet build src/Reactor -c Debug -p:Optimize=false -p:DebugType=portable --no-incremental
71-
dotnet build tests/Reactor.AppTests.Host -c Debug -p:Optimize=false -p:DebugType=portable --no-incremental
71+
dotnet build tests/Reactor.AppTests.Host -c Debug -p:Platform=x64 -p:Optimize=false -p:DebugType=portable --no-incremental
7272
7373
- name: Collect unit coverage
7474
shell: pwsh
7575
run: |
7676
dotnet-coverage collect -s coverage.settings.xml `
7777
--output unit.cobertura.xml --output-format cobertura `
78-
-- dotnet test tests/Reactor.Tests --no-build
78+
-- dotnet test tests/Reactor.Tests --no-build -p:Platform=x64
7979
8080
- name: Instrument Reactor.dll
8181
shell: pwsh
8282
run: |
83+
$dll = Get-ChildItem -Path "tests/Reactor.AppTests.Host/bin" -Recurse -Filter "Reactor.dll" |
84+
Where-Object { $_.FullName -notmatch 'ref[\\/]' } |
85+
Select-Object -First 1
86+
if (-not $dll) { throw "Reactor.dll not found under tests/Reactor.AppTests.Host/bin" }
87+
Write-Host "Instrumenting: $($dll.FullName)"
8388
dotnet-coverage instrument `
84-
"tests/Reactor.AppTests.Host/bin/x64/Debug/net10.0-windows10.0.22621.0/Reactor.dll" `
89+
$dll.FullName `
8590
-s coverage.settings.xml
8691
8792
- name: Collect selftest coverage
8893
shell: pwsh
8994
run: |
9095
dotnet-coverage collect -s coverage.settings.xml `
9196
--output selftest.cobertura.xml --output-format cobertura `
92-
-- dotnet run --project tests/Reactor.AppTests.Host --no-build -- --self-test
97+
-- dotnet run --project tests/Reactor.AppTests.Host --no-build -p:Platform=x64 -- --self-test
9398
9499
- name: Merge cobertura reports
95100
shell: pwsh

.github/workflows/release.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -91,17 +91,16 @@ jobs:
9191
Write-Host "Version: $version (event=$eventName, isTag=$isTag)"
9292
9393
- name: Restore
94-
run: dotnet restore Reactor.sln
94+
run: dotnet restore Reactor.slnx
9595

9696
- name: Build framework + analyzers
97-
run: dotnet build Reactor.sln --no-restore --configuration Release -p:Platform=x64
97+
run: dotnet build Reactor.slnx --no-restore --configuration Release
9898

9999
- name: Pack framework NuGet
100100
run: >
101101
dotnet pack src/Reactor/Reactor.csproj
102102
--no-build --configuration Release
103103
-p:Version=${{ steps.version.outputs.version }}
104-
-p:Platform=x64
105104
-o artifacts/nupkg
106105
107106
- name: Pack Templates
@@ -121,7 +120,6 @@ jobs:
121120
--configuration Release
122121
--runtime win-x64
123122
--self-contained false
124-
-p:Platform=x64
125123
-p:Version=${{ steps.version.outputs.version }}
126124
-o artifacts/mur/x64
127125
@@ -131,7 +129,6 @@ jobs:
131129
--configuration Release
132130
--runtime win-arm64
133131
--self-contained false
134-
-p:Platform=ARM64
135132
-p:Version=${{ steps.version.outputs.version }}
136133
-o artifacts/mur/arm64
137134

AGENTS.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ Reactor is a declarative, component-based C# framework for building WinUI 3 desk
55
## Build, Test, Lint
66

77
```bash
8-
# Build (platform defaults to machine arch; force with -p:Platform=x64 or ARM64)
9-
dotnet build Reactor.sln
8+
# Build (platform defaults to machine arch for apps; libraries are AnyCPU)
9+
dotnet build Reactor.slnx
1010

1111
# Unit tests — xUnit, headless, fast (~2200 tests incl. 590 Yoga fixtures)
1212
dotnet test tests/Reactor.Tests

CONTRIBUTING.md

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,26 +36,33 @@ This project has adopted the [Microsoft Open Source Code of Conduct](https://ope
3636

3737
```bash
3838
# Restore packages (pulls experimental WinUI 3 from NuGet)
39-
dotnet restore Reactor.sln
39+
dotnet restore Reactor.slnx
4040

4141
# Build the entire solution (framework, tests, test app, samples)
42-
dotnet build Reactor.sln -p:Platform=x64
42+
dotnet build Reactor.slnx
4343

4444
# Build just the framework
45-
dotnet build src/Reactor/Reactor.csproj -p:Platform=x64
45+
dotnet build src/Reactor/Reactor.csproj
4646
```
4747

4848
### From Visual Studio
4949

50-
1. Open `Reactor.sln` in Visual Studio 2022 (17.8+)
51-
2. Select the **x64** or **ARM64** platform from the toolbar (not "Any CPU")
50+
1. Open `Reactor.slnx` in Visual Studio 2022 (17.8+)
51+
2. Select the **x64** or **ARM64** platform from the toolbar
5252
3. Build the solution (Ctrl+Shift+B)
5353

5454
Visual Studio will restore NuGet packages on first load, pulling the experimental Windows App SDK.
5555

5656
### Platforms
5757

58-
The solution targets `x64` and `ARM64`. Omit `-p:Platform=...` to use the default (ARM64 on ARM machines, x64 on Intel). Add `-p:Platform=ARM64` or `-p:Platform=x64` to force one.
58+
Library projects (`Reactor`, `Reactor.Interop.WinForms`) are architecture-neutral (`AnyCPU`). Application projects (samples, tests, CLI) target `x64` and `ARM64`.
59+
60+
When building via the solution (`dotnet build Reactor.slnx`), the platform is selected automatically. When building a single app project directly, pass `-p:Platform=x64` (or `ARM64`):
61+
62+
```bash
63+
dotnet build tests/Reactor.Tests -p:Platform=x64
64+
dotnet test tests/Reactor.Tests -p:Platform=x64
65+
```
5966

6067
---
6168

@@ -201,7 +208,7 @@ Replace `$(RuntimeIdentifier)` with `ARM64` or `x64`, or omit the platform segme
201208
The interactive demo app exercises every built-in control:
202209

203210
```bash
204-
dotnet run --project samples/Reactor.TestApp -p:Platform=x64
211+
dotnet run --project samples/Reactor.TestApp
205212
```
206213

207214
---

Directory.Build.props

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,4 @@
1010
<WindowsAppSDKSelfContained>true</WindowsAppSDKSelfContained>
1111
</PropertyGroup>
1212

13-
<!-- Default Platform to the current machine architecture so that
14-
dotnet build / dotnet watch work without -p:Platform=ARM64. -->
15-
<PropertyGroup Condition="'$(Platform)' == '' or '$(Platform)' == 'AnyCPU'">
16-
<Platform Condition="'$(PROCESSOR_ARCHITECTURE)' == 'ARM64'">ARM64</Platform>
17-
<Platform Condition="'$(PROCESSOR_ARCHITECTURE)' != 'ARM64'">x64</Platform>
18-
</PropertyGroup>
19-
2013
</Project>

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -190,11 +190,11 @@ class App : Component
190190

191191
```bash
192192
# Restore and build
193-
dotnet restore Reactor.sln
194-
dotnet build Reactor.sln -p:Platform=x64
193+
dotnet restore Reactor.slnx
194+
dotnet build Reactor.slnx
195195

196196
# Run the interactive demo app
197-
dotnet run --project samples/Reactor.TestApp -p:Platform=x64
197+
dotnet run --project samples/Reactor.TestApp
198198

199199
# Unit tests (xUnit, headless)
200200
dotnet test tests/Reactor.Tests

0 commit comments

Comments
 (0)