Skip to content

Enable item templates for metapackage and WinUI projects#6604

Open
lauren-ciha wants to merge 2 commits into
mainfrom
user/laurenciha/investigate-missing-item-templates-without-metapackage
Open

Enable item templates for metapackage and WinUI projects#6604
lauren-ciha wants to merge 2 commits into
mainfrom
user/laurenciha/investigate-missing-item-templates-without-metapackage

Conversation

@lauren-ciha

Copy link
Copy Markdown
Member

Resolves #5923, which reported that the Add New Item menu omitted the WinUI templates when the WinUI PackageReference was included without the Windows App SDK metapackage.

Before, the item templates' .vstemplate AppliesTo property only had WindowsAppSDK, which is only emitted by the metapackage. Adding WinUI allows the item templates to appear when either the metapackage Microsoft.WindowsAppSDK or WinUI package Microsoft.WindowsAppSDK.WinUI is included in the project.

Notes:

  • The build assets for either package need to be included in order to see the item templates. Setting IncludeAssets=None in the PackageReference will omit the item templates.
  • If adding Windows App SDK or WinUI to an existing project, close and reopen VS to see the WinUI templates in the New Item menu

Validation:

  • Fetch and build the branch with .\dev\Templates\VSIX\build-local-VSIX-packagebuild-install-localdev-vsix.ps1.
  • Create a new C# template with the local dev templates
  • In the {AppName}.csproj, switch <PackageReference Include="Microsoft.WindowsAppSDK" Version="*" /> to Microsoft.WindowsAppSDK.WinUI.
  • Close VS
  • Reopen the same project in VS
  • Click "Add New Item" (Ctrl+Shift+A)

I ran the same validation on a standalone VSIX.


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.

@lauren-ciha

Copy link
Copy Markdown
Member Author

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 2 pipeline(s).

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.

Pull request overview

This PR addresses missing WinUI item templates in Visual Studio when a project references the WinUI split package (Microsoft.WindowsAppSDK.WinUI) instead of the Windows App SDK metapackage, by broadening template AppliesTo expressions to match either the WindowsAppSDK or WinUI project capability.

Changes:

  • Updated multiple item template .vstemplate files to use AppliesTo expressions that include (WindowsAppSDK | WinUI) for both C# and C++/WinRT templates.
  • Removed several wizard-related string resources from the C# VSIX VSPackage.resx.
  • Added a clarifying comment in the shared wizard implementation.

Reviewed changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
dev/Templates/VSIX/Shared/WizardImplementation.cs Adds a comment describing when NuGet installation is triggered during template generation.
dev/Templates/VSIX/Extension/Cs/Common/VSPackage.resx Removes wizard-related string resources (1044–1054) from the C# extension’s neutral resources.
dev/Templates/Source/ItemTemplates/Neutral/CSharp/UserControl/WinUI.Neutral.Cs.UserControl.vstemplate Broadens AppliesTo to include WinUI capability.
dev/Templates/Source/ItemTemplates/Neutral/CSharp/TemplatedControl/WinUI.Neutral.Cs.TemplatedControl.vstemplate Broadens AppliesTo to include WinUI capability.
dev/Templates/Source/ItemTemplates/Neutral/CSharp/Resw/WinUI.Neutral.Cs.Resw.vstemplate Broadens AppliesTo to include WinUI capability.
dev/Templates/Source/ItemTemplates/Neutral/CSharp/ResourceDictionary/WinUI.Neutral.Cs.ResourceDictionary.vstemplate Broadens AppliesTo to include WinUI capability.
dev/Templates/Source/ItemTemplates/Neutral/CSharp/ContentDialog/WinUI.Neutral.Cs.ContentDialog.vstemplate Broadens AppliesTo to include WinUI capability.
dev/Templates/Source/ItemTemplates/Neutral/CSharp/BlankPage/WinUI.Neutral.Cs.BlankPage.vstemplate Broadens AppliesTo to include WinUI capability.
dev/Templates/Source/ItemTemplates/Neutral/CppWinRT/UserControl/WinUI.Neutral.CppWinRT.UserControl.vstemplate Broadens AppliesTo to include WinUI capability.
dev/Templates/Source/ItemTemplates/Neutral/CppWinRT/TemplatedControl/WinUI.Neutral.CppWinRT.TemplatedControl.vstemplate Broadens AppliesTo to include WinUI capability.
dev/Templates/Source/ItemTemplates/Neutral/CppWinRT/Resw/WinUI.Neutral.CppWinRT.Resw.vstemplate Broadens AppliesTo to include WinUI capability.
dev/Templates/Source/ItemTemplates/Neutral/CppWinRT/ResourceDictionary/WinUI.Neutral.CppWinRT.ResourceDictionary.vstemplate Broadens AppliesTo to include WinUI capability.
dev/Templates/Source/ItemTemplates/Neutral/CppWinRT/BlankPage/WinUI.Neutral.CppWinRT.BlankPage.vstemplate Broadens AppliesTo to include WinUI capability.
dev/Templates/Source/ItemTemplates/Desktop/CSharp/BlankWindow/WinUI.Desktop.Cs.BlankWindow.vstemplate Broadens AppliesTo to include WinUI capability.
dev/Templates/Source/ItemTemplates/Desktop/CppWinRT/BlankWindow/WinUI.Desktop.CppWinRT.BlankWindow.vstemplate Broadens AppliesTo to include WinUI capability.

Comment thread dev/Templates/VSIX/Extension/Cs/Common/VSPackage.resx
Comment thread dev/Templates/VSIX/Shared/WizardImplementation.cs
@lauren-ciha
lauren-ciha force-pushed the user/laurenciha/investigate-missing-item-templates-without-metapackage branch from 2a53391 to f806d9f Compare July 21, 2026 22:05
@lauren-ciha

Copy link
Copy Markdown
Member Author

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 2 pipeline(s).
1 pipeline(s) were filtered out due to trigger conditions.

lauren-ciha and others added 2 commits July 21, 2026 17:40
VS 'Add New Item' item templates gated visibility on the 'WindowsAppSDK' project capability, which is only contributed by the meta Microsoft.WindowsAppSDK package. Projects referencing only the split Microsoft.WindowsAppSDK.WinUI package get the 'WinUI' capability instead, so the templates never appeared.

Relax AppliesTo in all 13 item templates to accept either capability: 'CSharp + (WindowsAppSDK | WinUI)' and 'VisualC + (WindowsAppSDK | WinUI)'. Parentheses are required because '+'/'&' (AND) bind tighter than '|' (OR).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@lauren-ciha
lauren-ciha force-pushed the user/laurenciha/investigate-missing-item-templates-without-metapackage branch from f806d9f to d2818ae Compare July 22, 2026 00:43
@lauren-ciha

Copy link
Copy Markdown
Member Author

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 2 pipeline(s).
1 pipeline(s) were filtered out due to trigger conditions.

@lauren-ciha
lauren-ciha requested a review from Scottj1s July 22, 2026 18:28
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.

Using the independent WinUI 3 package, Visual Studio cannot find the WinUI template

2 participants