Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 31 additions & 4 deletions dev/VSIX/DotnetNewTemplates/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,32 @@ is installed. Item templates only surface when `dotnet new` is executed inside a
WinUI project folder (or when `--project` points to one) so that commands stay
context-aware.

### Choosing a Target Framework

All templates currently default to `net8.0` for compatibility with the widest
set of Windows App SDK tooling. To target a newer .NET version you can either:

1. Pass `--dotnet-version <tfm>` (for example `--dotnet-version net10.0`) when
running `dotnet new ...`.
2. Edit the generated `.csproj` afterward and change `<TargetFramework>` (and
any related `<RuntimeIdentifiers>` entries) to your preferred TFM.

`dotnet new winui --dotnet-version net10.0 -n MyApp` is the quickest way to spin
up a project that targets .NET 10 while still using the same template payload.

### CLI Quick Reference

- Create a blank WinUI app: `dotnet new winui -n MyApp`
- Add a page to an existing project: `dotnet new winui-page -n SettingsPage --project .\MyApp.csproj`
- Add a user control: `dotnet new winui-usercontrol -n ProfileCard --project .\MyApp.csproj`
- Launch the packaged app directly: `dotnet run -c Debug -p:Platform=$env:PROCESSOR_ARCHITECTURE`
- Launch with WinApp Runtime tooling (after building/registering): `winapp run .\MyApp\bin\x64\Debug\<TargetFramework>\MyApp.exe`

Whenever possible prefer the CLI scaffolding over hand authoring new files so
token replacements, namespaces, and resource wiring stay consistent.
Replace `<TargetFramework>` with the exact folder emitted by your build (for
example `net8.0-windows10.0.19041.0`).

## Local testing workflow

1. Pack the templates: `dotnet pack dev/VSIX/DotnetNewTemplates/WinAppSdk.CSharp.DotnetNewTemplates.csproj -c Release -o localpackages`.
Expand All @@ -47,8 +73,9 @@ dotnet pack dev/VSIX/DotnetNewTemplates/WinAppSdk.CSharp.DotnetNewTemplates.cspr
`BuildAll.ps1` also runs the same packing step so official builds automatically emit
the template pack alongside the other Windows App SDK artifacts.

## Azure Pipelines validation
## Validation checklist

- Windows builds run through [ProjectReunion Template Pack](https://dev.azure.com/microsoft/ProjectReunion/_build?definitionId=186691). To trigger it, first mirror your changes into the internal Foundation repo, then queue the pipeline manually.
- Before running the pipeline, bump the `<Version>` in [WinAppSdk.CSharp.DotnetNewTemplates.csproj](WinAppSdk.CSharp.DotnetNewTemplates.csproj#L3-L38) to avoid conflicts when the “publish to internal feed” option is enabled.
- Successful runs publish the resulting `.nupkg` both as a pipeline artifact and (if that option is selected) to the internal feed [Project.Reunion.nuget.internal](https://dev.azure.com/microsoft/ProjectReunion/_artifacts/feed/Project.Reunion.nuget.internal/NuGet/Microsoft.WindowsAppSDK.WinUI.CSharp.Templates).
- Run `dotnet pack` locally (as shown above) and use `dotnet new install` to verify each template still scaffolds and runs.
- Execute `dotnet new --list | findstr winui` (PowerShell: `dotnet new --list | Select-String winui`) to confirm the pack metadata surfaces correctly.
- Open the generated projects in Visual Studio or VS Code, build them for x86/x64/ARM64, and ensure packaged deployments succeed on Windows 10 version 1809 or later.
- When contributing changes, note the updated template version in your PR description so downstream publishing systems pick up the new package.
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@
<Version>0.0.1-experimental</Version>
<Authors>Microsoft</Authors>
<Company>Microsoft</Company>
<Description>dotnet new templates that mirror the Windows App SDK WinUI 3 Visual Studio templates.</Description>
<PackageTags>windows;winappsdk;winui;desktop;csharp</PackageTags>
<PackageProjectUrl>https://github.com/microsoft/WindowsAppSDK</PackageProjectUrl>
<Description>Official WinUI 3 project and item templates for the Windows App SDK. Install this pack to use dotnet new for blank apps, navigation views, libraries, unit tests, and common WinUI UI items that match the Visual Studio experience.</Description>
<PackageTags>windows;winappsdk;winui;winui3;desktop;dotnet-new;templates;csharp</PackageTags>
<PackageProjectUrl>https://learn.microsoft.com/windows/apps/windows-app-sdk/</PackageProjectUrl>
<RepositoryUrl>https://github.com/microsoft/WindowsAppSDK</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageReadmeFile>README.md</PackageReadmeFile>
<Copyright>© Microsoft Corporation. All rights reserved.</Copyright>
<Copyright>(c) Microsoft Corporation. All rights reserved.</Copyright>
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
<PackageReleaseNotes>See https://github.com/microsoft/WindowsAppSDK/releases for release notes.</PackageReleaseNotes>
<SuppressDependenciesWhenPacking>true</SuppressDependenciesWhenPacking>
Expand All @@ -37,10 +37,10 @@
PackagePath="content/winui.blankapp/.template.config/%(RecursiveDir)%(Filename)%(Extension)" />
<None Include="templates\single-project\Agents.md"
Pack="true"
PackagePath="content/winui.blankapp/Agents.md" />
PackagePath="content/winui.blankapp/.github/agents/Agents.md" />
<None Include="templates\single-project\instructions\**\*.*"
Pack="true"
PackagePath="content/winui.blankapp/instructions/%(RecursiveDir)%(Filename)%(Extension)" />
PackagePath="content/winui.blankapp/.github/instructions/%(RecursiveDir)%(Filename)%(Extension)" />
<None Include="..\ProjectTemplates\Desktop\CSharp\SingleProjectPackagedApp\**\*.*"
Exclude="..\ProjectTemplates\Desktop\CSharp\SingleProjectPackagedApp\bin\**;..\ProjectTemplates\Desktop\CSharp\SingleProjectPackagedApp\obj\**;..\ProjectTemplates\Desktop\CSharp\SingleProjectPackagedApp\Package-managed.appxmanifest;..\ProjectTemplates\Desktop\CSharp\SingleProjectPackagedApp\WinUI.Desktop.Cs.SingleProjectPackagedApp.csproj;..\ProjectTemplates\Desktop\CSharp\SingleProjectPackagedApp\WinUI.Desktop.Cs.SingleProjectPackagedApp.ico;..\ProjectTemplates\Desktop\CSharp\SingleProjectPackagedApp\WinUI.Desktop.Cs.SingleProjectPackagedApp.png;..\ProjectTemplates\Desktop\CSharp\SingleProjectPackagedApp\WinUI.Desktop.Cs.SingleProjectPackagedApp.vstemplate"
Pack="true"
Expand Down
Loading