Skip to content

WinUI3 dotnet new tempalte updates #6359

Open
nmetulev wants to merge 2 commits intomicrosoft:user/muyuanli/dotnetnewtemplatefrom
nmetulev:nm/template-updates
Open

WinUI3 dotnet new tempalte updates #6359
nmetulev wants to merge 2 commits intomicrosoft:user/muyuanli/dotnetnewtemplatefrom
nmetulev:nm/template-updates

Conversation

@nmetulev
Copy link
Copy Markdown
Member

Quality-of-life improvements to the WinUI 3 dotnet new template pack to align with modern .NET conventions and improve the new project experience for users and AI agents.

Changes

  1. Frame + MainPage architecture (blank app template)
  • MainWindow now hosts a instead of an empty , with MainPage as the default content
  • Prevents a common pitfall where users/agents try to use Page-only features directly on Window
  • Added guiding comments in XAML and code-behind directing users to add their UI in MainPage
  1. Pinned NuGet package versions with auto-update
  • Replaced Version="*" with pinned stable versions (Microsoft.WindowsAppSDK
    1.8.260317003, Microsoft.Windows.SDK.BuildTools 10.0.26100.7705) as an offline fallback
  • Added addPackageReference post-actions that run dotnet add package at scaffold time to resolve the latest stable version from NuGet automatically
  • Both winui and winui-navview templates benefit; continueOnError: true ensures offline scaffolding still works
  • Also fixed the NavigationApp csproj which had an unconditional workaround block — now uses the proper #if conditional
  1. .gitignore included in all project templates
  • All four project templates (winui, winui-navview, winui-lib, winui-unittest) now scaffold a .gitignore covering .NET, Visual Studio, MSIX, and common tooling artifacts
  • Single shared source file (templates/gitignore.txt) mapped via template engine rename rules
  1. Implicit usings enabled
  • Added enable to all four project template csproj files
  • Removed redundant System.* usings from all .cs files (now auto-imported by the SDK)
  • Kept Microsoft.UI.Xaml.* usings in App/Window code-behind files for discoverability
  1. winui3 short name aliases
  • All templates now accept winui3-* as an alias (e.g., dotnet new winui3, dotnet new winui3-navview)
  • Uses shortName as a JSON array — the shortNameList field was not honored by the CLI host

A microsoft employee must use /azp run to validate using the pipelines below.

WARNING:
Comments made by azure-pipelines bot maybe inaccurate.
Please see pipeline link to verify that the build is being ran.

For status checks on the main branch, please use TransportPackage-Foundation-PR
(https://microsoft.visualstudio.com/ProjectReunion/_build?definitionId=81063&_a=summary)
and run the build against your PR branch with the default parameters.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant