Enable item templates for metapackage and WinUI projects#6604
Open
lauren-ciha wants to merge 3 commits into
Open
Enable item templates for metapackage and WinUI projects#6604lauren-ciha wants to merge 3 commits into
lauren-ciha wants to merge 3 commits into
Conversation
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>
Member
Author
|
/azp run |
|
Azure Pipelines successfully started running 2 pipeline(s). |
Contributor
There was a problem hiding this comment.
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
.vstemplatefiles to useAppliesToexpressions 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 on lines
219
to
224
| <data name="1043" xml:space="preserve"> | ||
| <value>A project template that creates MSIX packages containing WinUI applications for side-loading or distribution via the Microsoft Store.</value> | ||
| </data> | ||
| <data name="1044" xml:space="preserve"> | ||
| <value>Installing NuGet packages into project...</value> | ||
| </data> | ||
| <data name="1045" xml:space="preserve"> | ||
| <value>Operation in progress...</value> | ||
| </data> | ||
| <data name="1046" xml:space="preserve"> | ||
| <value>Missing Package Reference(s)</value> | ||
| </data> | ||
| <data name="1047" xml:space="preserve"> | ||
| <value>Unable to add references to the following packages for {0}: {1}. Please add package references before building.</value> | ||
| </data> | ||
| <data name="1048" xml:space="preserve"> | ||
| <value>[{0}] Unable to add references to the following packages: {1}. This is an environment error. Please add package references before building the project.</value> | ||
| </data> | ||
| <data name="1049" xml:space="preserve"> | ||
| <value>Manage NuGet Packages</value> | ||
| </data> | ||
| <data name="1050" xml:space="preserve"> | ||
| <value>See error details</value> | ||
| </data> | ||
| <data name="1051" xml:space="preserve"> | ||
| <value>Missing Package References for {0}:</value> | ||
| </data> | ||
| <data name="1052" xml:space="preserve"> | ||
| <value>Please manually add package references before building.</value> | ||
| </data> | ||
| <data name="1053" xml:space="preserve"> | ||
| <value>General</value> | ||
| </data> | ||
| <data name="1054" xml:space="preserve"> | ||
| <value>No output information available.</value> | ||
| </data> | ||
| <data name="1055" xml:space="preserve"> | ||
| <value>WinUI TabView App</value> | ||
| </data> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves #5923, which reported that the
Add New Itemmenu omitted the WinUI templates when the WinUIPackageReferencewas included without the Windows App SDK metapackage.Before, the item templates'
.vstemplateAppliesToproperty only hadWindowsAppSDK, which is only emitted by the metapackage. AddingWinUIallows the item templates to appear when either the metapackageMicrosoft.WindowsAppSDKor WinUI packageMicrosoft.WindowsAppSDK.WinUIis included in the project.Notes:
buildassets for either package need to be included in order to see the item templates. SettingIncludeAssets=Nonein thePackageReferencewill omit the item templates.Validation:
.\dev\Templates\VSIX\build-local-VSIX-packagebuild-install-localdev-vsix.ps1.<PackageReference Include="Microsoft.WindowsAppSDK" Version="*" />toMicrosoft.WindowsAppSDK.WinUI.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.