Skip to content

[Templates] Align framework selection with Android and MAUI - #26849

Open
jonathanpeppers wants to merge 3 commits into
mainfrom
jonathanpeppers-template-framework-alignment
Open

jonathanpeppers wants to merge 3 commits into
mainfrom
jonathanpeppers-template-framework-alignment

Conversation

@jonathanpeppers

Copy link
Copy Markdown
Member

Summary

Align Apple project-template framework selection with dotnet/android#13119 and the corresponding MAUI template CLI behavior.

  • Map the existing capitalized Framework symbol to --framework and -f in all 28 project-template variants, including C#, F#, and Visual Basic where available, notification extensions, and the tabbed application.
  • Add the missing .NET 11/.NET 10 framework choice and target-framework replacement to iostest, tvostest, macostest, and maccatalysttest.
  • Add generation regression coverage for the default and every supported framework through both CLI spellings. Preserve existing choices/defaults and unrelated parameters; update only English template string catalogs. Item templates and translated catalogs are unchanged.

What was not aligned

Apple templates: None of the project templates had a CLI host mapping for Framework, so lowercase --framework was rejected. The four test templates also lacked framework selection entirely, despite their sibling application/library/binding templates already supporting .NET 11 and .NET 10. This PR fixes both gaps.

MAUI comparison: Five MAUI project templates already expose --framework and -f; the engine derives -f from the lowercase longName even without an explicit shortName. MAUI's version-specific packaging and bare framework values are intentional differences, not something to copy into Apple templates.

One additional upstream inconsistency was found in MAUI's Aspire service-defaults template: its host file is named dotnetcli.json rather than dotnetcli.host.json. Runtime verification showed --framework and -f fail with exit code 127, while --Framework and -F succeed. Renaming that file is a separate fix needed in dotnet/maui; it is not included here.

Validation

  • Reproduced the original ios and iostest lowercase-option failures before the change (exit code 127).
  • Compiled the NUnit test project and passed all 140 new generation cases with zero failures/skips: 28 template variants × default plus two frameworks through two option spellings.
  • Separately passed 28 invalid-framework rejection checks and four test-template bundleId/minOSVersion preservation checks.
  • Checked JSON validity, unchanged existing parameters, English-only catalog changes, and git diff --check.

The normal SDK invocation is blocked on this Windows host by the unavailable pinned SDK 12.0.100-alpha.1.26480.102. Validation used installed SDK 11.0.100-rc.1.26425.128 with isolated template installations, after restoring the missing Xamarin.MacDev submodule. Native Apple build/run testing was not performed: it requires macOS, Xcode, and Apple workloads.

Note

This PR description and implementation were generated with GitHub Copilot.

Match dotnet/android#13119 by mapping Framework to --framework and -f. Add framework choices to the four Apple test templates and cover generation for all project-template variants.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 284c6980-1fc2-4171-8d57-7ea26e0b7330
Copilot AI balanced review requested due to automatic review settings October 13, 2026 14:27

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The regression tests derive expected frameworks from the configuration under test and therefore cannot detect removed choices or changed defaults.

1 open finding
What changed in this PR

Aligns Apple project templates with Android/MAUI framework-selection behavior.

Changes:

  • Adds --framework/-f mappings to all 28 project-template variants.
  • Adds .NET 11/.NET 10 selection to four test templates.
  • Adds framework generation regression tests and CLI argument support.
File Description
tests/​dotnet/​UnitTests/​TemplateTest.cs Adds framework-generation tests.
tests/​common/​DotNet.cs Supports extra dotnet new arguments.
dotnet/​Templates/​Microsoft.tvOS.Templates/​tvostest/​csharp/​.template.config/​template.json Adds test-template framework choices.
dotnet/​Templates/​Microsoft.tvOS.Templates/​tvostest/​csharp/​.template.config/​localize/​templatestrings.en.json Localizes framework choices.
dotnet/​Templates/​Microsoft.tvOS.Templates/​tvostest/​csharp/​.template.config/​dotnetcli.host.json Maps framework CLI options.
dotnet/​Templates/​Microsoft.tvOS.Templates/​tvoslib/​visualbasic/​.template.config/​dotnetcli.host.json Maps framework CLI options.
dotnet/​Templates/​Microsoft.tvOS.Templates/​tvoslib/​csharp/​.template.config/​dotnetcli.host.json Maps framework CLI options.
dotnet/​Templates/​Microsoft.tvOS.Templates/​tvosbinding/​csharp/​.template.config/​dotnetcli.host.json Maps framework CLI options.
dotnet/​Templates/​Microsoft.tvOS.Templates/​tvos/​visualbasic/​.template.config/​dotnetcli.host.json Maps framework CLI options.
dotnet/​Templates/​Microsoft.tvOS.Templates/​tvos/​csharp/​.template.config/​dotnetcli.host.json Maps framework CLI options.
dotnet/​Templates/​Microsoft.macOS.Templates/​macostest/​csharp/​.template.config/​template.json Adds test-template framework choices.
dotnet/​Templates/​Microsoft.macOS.Templates/​macostest/​csharp/​.template.config/​localize/​templatestrings.en.json Localizes framework choices.
dotnet/​Templates/​Microsoft.macOS.Templates/​macostest/​csharp/​.template.config/​dotnetcli.host.json Maps framework CLI options.
dotnet/​Templates/​Microsoft.macOS.Templates/​macoslib/​visualbasic/​.template.config/​dotnetcli.host.json Maps framework CLI options.
dotnet/​Templates/​Microsoft.macOS.Templates/​macoslib/​csharp/​.template.config/​dotnetcli.host.json Maps framework CLI options.
dotnet/​Templates/​Microsoft.macOS.Templates/​macosbinding/​csharp/​.template.config/​dotnetcli.host.json Maps framework CLI options.
dotnet/​Templates/​Microsoft.macOS.Templates/​macos/​visualbasic/​.template.config/​dotnetcli.host.json Maps framework CLI options.
dotnet/​Templates/​Microsoft.macOS.Templates/​macos/​csharp/​.template.config/​dotnetcli.host.json Maps framework CLI options.
dotnet/​Templates/​Microsoft.MacCatalyst.Templates/​maccatalysttest/​csharp/​.template.config/​template.json Adds test-template framework choices.
dotnet/​Templates/​Microsoft.MacCatalyst.Templates/​maccatalysttest/​csharp/​.template.config/​localize/​templatestrings.en.json Localizes framework choices.
dotnet/​Templates/​Microsoft.MacCatalyst.Templates/​maccatalysttest/​csharp/​.template.config/​dotnetcli.host.json Maps framework CLI options.
dotnet/​Templates/​Microsoft.MacCatalyst.Templates/​maccatalystlib/​visualbasic/​.template.config/​dotnetcli.host.json Maps framework CLI options.
dotnet/​Templates/​Microsoft.MacCatalyst.Templates/​maccatalystlib/​csharp/​.template.config/​dotnetcli.host.json Maps framework CLI options.
dotnet/​Templates/​Microsoft.MacCatalyst.Templates/​maccatalystbinding/​csharp/​.template.config/​dotnetcli.host.json Maps framework CLI options.
dotnet/​Templates/​Microsoft.MacCatalyst.Templates/​maccatalyst/​visualbasic/​.template.config/​dotnetcli.host.json Maps framework CLI options.
dotnet/​Templates/​Microsoft.MacCatalyst.Templates/​maccatalyst/​csharp/​.template.config/​dotnetcli.host.json Maps framework CLI options.
dotnet/​Templates/​Microsoft.iOS.Templates/​iostest/​csharp/​.template.config/​template.json Adds test-template framework choices.
dotnet/​Templates/​Microsoft.iOS.Templates/​iostest/​csharp/​.template.config/​localize/​templatestrings.en.json Localizes framework choices.
dotnet/​Templates/​Microsoft.iOS.Templates/​iostest/​csharp/​.template.config/​dotnetcli.host.json Maps framework CLI options.
dotnet/​Templates/​Microsoft.iOS.Templates/​ioslib/​visualbasic/​.template.config/​dotnetcli.host.json Maps framework CLI options.
dotnet/​Templates/​Microsoft.iOS.Templates/​ioslib/​csharp/​.template.config/​dotnetcli.host.json Maps framework CLI options.
dotnet/​Templates/​Microsoft.iOS.Templates/​iosbinding/​csharp/​.template.config/​dotnetcli.host.json Maps framework CLI options.
dotnet/​Templates/​Microsoft.iOS.Templates/​ios/​visualbasic/​.template.config/​dotnetcli.host.json Maps framework CLI options.
dotnet/​Templates/​Microsoft.iOS.Templates/​ios/​fsharp/​.template.config/​dotnetcli.host.json Maps framework CLI options.
dotnet/​Templates/​Microsoft.iOS.Templates/​ios/​csharp/​.template.config/​dotnetcli.host.json Maps framework CLI options.
dotnet/​Templates/​Microsoft.iOS.Templates/​ios-tabbed/​.template.config/​dotnetcli.host.json Maps framework CLI options.
dotnet/​Templates/​Microsoft.iOS.Templates/​ios-notification-service-extension/​csharp/​.template.config/​dotnetcli.host.json Maps framework CLI options.
dotnet/​Templates/​Microsoft.iOS.Templates/​ios-notification-content-extension/​csharp/​.template.config/​dotnetcli.host.json Maps framework CLI options.

🧠 Review effort: Balanced

Comment thread tests/dotnet/UnitTests/TemplateTest.cs
@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

rolfbjarne
rolfbjarne previously approved these changes Oct 13, 2026
@rolfbjarne
rolfbjarne enabled auto-merge (squash) October 13, 2026 16:16
Copilot AI balanced review requested due to automatic review settings October 13, 2026 16:52

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The 52 non-English catalog edits contradict the stated English-only localization scope and should be removed.

53 open findings

And 33 more that still need to be addressed.

🧠 Review effort: Balanced

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

Copy link
Copy Markdown
Collaborator

🔥 [CI Build #422e6f7] Test results 🔥

Test results

❌ Tests failed on VSTS: test results

0 tests crashed, 3 tests failed, 218 tests passed.

Failures

❌ dotnettests tests (iOS)

1 tests failed, 0 tests passed.

Failed tests

  • DotNet tests: Failed (Execution failed with exit code 1)
    • Xamarin.Tests.DotNetWatchTest.DotNetWatch(iOS,False): Timed out waiting for the app to start. Output:
      dotnet watch 🔥 Hot reload enabled. For a list of supported edits, see https://a...

Html Report (VSDrops) Download

❌ dotnettests tests (macOS)

1 tests failed, 0 tests passed.

Failed tests

  • DotNet tests: Failed (Execution failed with exit code 1)
    • Xamarin.Tests.AppSizeTest.CoreCLR_R2R(MacOSX,"osx-arm64;osx-x64"...: App size changed significantly (+11,959 bytes (11.7 KB = 0.0 MB) different > tolerance of +-10,240 bytes (10.0 KB = 0.0 MB)). Ex...

Html Report (VSDrops) Download

❌ monotouch tests (iOS)

1 tests failed, 19 tests passed.

Failed tests

  • monotouch-test/iOS - simulator/Debug (PrepareAssemblies): LaunchTimedOut

Html Report (VSDrops) Download

Successes

✅ assembly-processing: All 1 tests passed. Html Report (VSDrops) Download
✅ cecil: All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (MacCatalyst): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (Multiple platforms): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (tvOS): All 1 tests passed. Html Report (VSDrops) Download
✅ framework: All 2 tests passed. Html Report (VSDrops) Download
✅ fsharp: All 4 tests passed. Html Report (VSDrops) Download
✅ generator: All 5 tests passed. Html Report (VSDrops) Download
✅ interdependent-binding-projects: All 4 tests passed. Html Report (VSDrops) Download
✅ introspection: All 4 tests passed. Html Report (VSDrops) Download
✅ linker (iOS): All 21 tests passed. Html Report (VSDrops) Download
✅ linker (MacCatalyst): All 21 tests passed. Html Report (VSDrops) Download
✅ linker (macOS): All 21 tests passed. Html Report (VSDrops) Download
✅ linker (tvOS): All 21 tests passed. Html Report (VSDrops) Download
✅ monotouch (MacCatalyst): All 20 tests passed. Html Report (VSDrops) Download
✅ monotouch (macOS): All 20 tests passed. Html Report (VSDrops) Download
✅ monotouch (tvOS): All 20 tests passed. Html Report (VSDrops) Download
✅ msbuild: All 2 tests passed. Html Report (VSDrops) Download
✅ sharpie: All 1 tests passed. Html Report (VSDrops) Download
✅ windows: All 3 tests passed. Html Report (VSDrops) Download
✅ xcframework: All 4 tests passed. Html Report (VSDrops) Download
✅ xtro: All 1 tests passed. Html Report (VSDrops) Download

macOS tests

✅ Tests on macOS Sonoma (14): All 5 tests passed. Html Report (VSDrops) Download
✅ Tests on macOS Sequoia (15): All 5 tests passed. Html Report (VSDrops) Download
✅ Tests on macOS Tahoe (26): All 5 tests passed. Html Report (VSDrops) Download
✅ Tests on macOS Golden Gate (27): All 5 tests passed. Html Report (VSDrops) Download

Linux Build Verification

✅ Linux build succeeded

Pipeline on Agent
Hash: 422e6f70d66036b111124d8542e146407836708f [PR build]

@vs-mobiletools-engineering-service2

Copy link
Copy Markdown
Collaborator

⚠️ AppSizeTest expected files changed ⚠️

The AppSizeTest detected changes in the expected app size files.

To update the expected files, add a comment with the following command:

/apply-gist https://gist.github.com/vs-mobiletools-engineering-service2/169bcd9efb57f2abd71d53e2821a9a0e
Updated files
  • MacOSX-CoreCLR-R2R-size.txt

Pipeline on Agent
Hash: 422e6f70d66036b111124d8542e146407836708f [PR build]

@rolfbjarne rolfbjarne self-assigned this Oct 14, 2026
Copilot AI balanced review requested due to automatic review settings October 14, 2026 15:55

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vs-mobiletools-engineering-service2

Copy link
Copy Markdown
Collaborator

✅ API diff for current PR / commit

NET (empty diffs)

✅ API diff vs stable

NET (empty diffs)

ℹ️ Generator diff

Generator Diff: vsdrops (html) vsdrops (raw diff) gist (raw diff) - Please review changes)

Pipeline on Agent
Hash: 2e3b4b02dcb87fdb7b8532b79b1bece1bc8f06c6 [PR build]

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants