Skip to content

Add ContentDialog item template to the VSIX#6607

Open
lauren-ciha wants to merge 1 commit into
mainfrom
user/laurenciha/content-dialog-item-template
Open

Add ContentDialog item template to the VSIX#6607
lauren-ciha wants to merge 1 commit into
mainfrom
user/laurenciha/content-dialog-item-template

Conversation

@lauren-ciha

Copy link
Copy Markdown
Member

Resolves #3723 and #5941

The ContentDialog item template was present since #6407 for the dotnet templates. To add them to the VSIX templates, they needed unique strings and $parameter$ syntax instead of __WINUI_CONTENT_DIALOG__, the latter of which only works with the dotnet template engine. The $parameter$ syntax works in both.

Validation:

  • Fetch and build the branch with .\dev\Templates\VSIX\build-local-VSIX-packagebuild-install-localdev-vsix.ps1.
  • For each C# templates in Visual Studio:
    • Created a project with the template
    • Opened the New Item menu (Ctrl+Shift+A)
    • Selected the ContentDialog
    • Added a button to the main page
    • Built and deployed with F5
    • Confirmed that the ContentDialog appeared on the button click
  • For the Class library template, I confirmed that the solution built with the content dialog included
  • Confirmed there were no regressions on the dotnet templates with .\dev\Templates\Dotnet\Test-DotnetNewTemplates.ps1 -WindowsAppSDkVersion "2.2.0" -dotnetsdkversion "*"

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 pull request adds the WinUI 3 ContentDialog item template to the Visual Studio VSIX templates, aligning the VSIX and dotnet new item template sources by using VS-compatible $parameter$ replacements and adding the necessary VSIX string resources.

Changes:

  • Add new VSIX string resources for the ContentDialog item template (including an experimental name variant).
  • Update the ContentDialog .vstemplate to reference the new string IDs.
  • Update the shared ContentDialog item template source (.xaml / .xaml.cs) to use $rootnamespace$ / $safeitemname$ and concrete WinUI types so it works for both VSIX and dotnet new.
  • Adjust experimental VSIX DisplayName generation to avoid exceeding the manifest’s 50-character limit.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
dev/Templates/VSIX/Extension/Directory.Build.targets Updates experimental VSIX DisplayName generation logic (length constraint handling).
dev/Templates/VSIX/Extension/Cs/Common/VSPackage.resx Adds new string resources (name/experimental name/description) for the ContentDialog template.
dev/Templates/Source/ItemTemplates/Neutral/CSharp/ContentDialog/WinUI.Neutral.Cs.ContentDialog.vstemplate Switches Name/Description IDs to the newly added string resources.
dev/Templates/Source/ItemTemplates/Neutral/CSharp/ContentDialog/ContentDialog.xaml.cs Replaces dotnet-template-only tokens with VSIX-compatible parameters and concrete WinUI types.
dev/Templates/Source/ItemTemplates/Neutral/CSharp/ContentDialog/ContentDialog.xaml Replaces dotnet-template-only tokens with VSIX-compatible parameters and concrete WinUI markup.

the trailing deployment parenthetical (e.g. " (LocalDev)") - the
deployment is already encoded in the .Experimental Identity/suffix.
-->
<ExperimentalVsixDisplayName>Experimental $([System.Text.RegularExpressions.Regex]::Replace('$(_OriginalVsixName)', ' \(.*\)', ''))</ExperimentalVsixDisplayName>
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.

Proposal: Add VS Item Template for WinUI 3's ContentDialog

2 participants