Skip to content

Propagate the PackageReference version into the C# wapproj template's BlankApp project file - #6705

Open
Lauren Ciha (lauren-ciha) wants to merge 8 commits into
mainfrom
user/laurenciha/add-blankapp-template-parameters-to-vs
Open

Propagate the PackageReference version into the C# wapproj template's BlankApp project file#6705
Lauren Ciha (lauren-ciha) wants to merge 8 commits into
mainfrom
user/laurenciha/add-blankapp-template-parameters-to-vs

Conversation

@lauren-ciha

Copy link
Copy Markdown
Member

This PR corrects a bug where the wapproj's BlankApp project failed to resolve the floating package reference for its NuGet dependencies. The problem was that the $WindowsAppSdkVersion$, $WindowsSdkBuildToolsVersion$, and $WindowsSdkBuildToolsWinAppVersion$ were passed into the BlankApp.csproj file directly when the variable comes from the parent project. The fix was to prepend ext_ to the variable name so the VS template engine could substitute the variables as expected.

I verified this fix locally using dev\Templates\VSIX\build-local-VSIX-package\build-install-localdev-vsix.ps1 with MSBuild 17 (from Visual Studio 2022) and manually verifying that the template built and deployed on Visual Studio 2026. I chose to use MSBuild 17 because there is a bug in MSBuild 18 where template projects are built, but not included in the VSIX file. To work around this bug in the future, I added a check in build-vsix-local.ps1 to verify that the correct number of templates were included in the VSIX and an MSBuildVersion parameter to select the MSBuild version to test.


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.

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

@lauren-ciha Lauren Ciha (lauren-ciha) changed the title Propagate the PackageReference version Propagate the PackageReference version into the C# wapproj template's BlankApp project file Aug 19, 2026

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 fixes version propagation in the C# packaged-app VS template so the BlankApp project resolves its NuGet PackageReference versions correctly when instantiated, and adds guardrails to local VSIX build scripts (MSBuild version selection + VSIX template-content validation).

Changes:

  • Add ext_-prefixed template parameters for Windows App SDK / BuildTools package versions and update the BlankApp template csproj to consume them.
  • Add an MsBuildVersion parameter to local VSIX build/install scripts and use it to select the matching MSBuild via vswhere.
  • Enhance Test-DotnetNewTemplates.ps1 to fall back to dotnet package search when SYSTEM_ACCESSTOKEN is unavailable.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
dev/Templates/VSIX/build-local-VSIX-package/Build-VSIX-Local.ps1 Adds MSBuild major-version selection and validates generated VSIX contains templates.
dev/Templates/VSIX/build-local-VSIX-package/build-install-localdev-vsix.ps1 Plumbs MSBuild major-version selection into the end-to-end local build+install loop.
dev/Templates/Source/ProjectTemplates/Desktop/CSharp/PackagedApp/WinUI.Desktop.Cs.PackagedApp.vstemplate Introduces custom parameters for package version propagation to linked templates.
dev/Templates/Source/ProjectTemplates/Desktop/CSharp/PackagedApp/BlankApp/ProjectTemplate.csproj Consumes propagated ext_ parameters for NuGet package versions.
dev/Templates/Dotnet/Test-DotnetNewTemplates.ps1 Adds non-pipeline fallback for determining latest official Microsoft.WindowsAppSDK version.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread dev/Templates/VSIX/build-local-VSIX-package/Build-VSIX-Local.ps1 Outdated
Comment thread dev/Templates/VSIX/build-local-VSIX-package/Build-VSIX-Local.ps1 Outdated
Comment thread dev/Templates/Dotnet/Test-DotnetNewTemplates.ps1
Comment thread dev/Templates/Dotnet/Test-DotnetNewTemplates.ps1
Comment thread dev/Templates/Dotnet/Test-DotnetNewTemplates.ps1
@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 (lauren-ciha) force-pushed the user/laurenciha/add-blankapp-template-parameters-to-vs branch from 2f535e9 to d264a99 Compare August 26, 2026 17: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.

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.

2 participants