Skip to content

Dotnet Templates: Update default UmbracoVersion template value using MSBuild target (closes #21889)#21893

Merged
Zeegaan merged 1 commit intomainfrom
v17/bugfix/fix-version-for-extension-template
Feb 25, 2026
Merged

Dotnet Templates: Update default UmbracoVersion template value using MSBuild target (closes #21889)#21893
Zeegaan merged 1 commit intomainfrom
v17/bugfix/fix-version-for-extension-template

Conversation

@AndyButland
Copy link
Copy Markdown
Contributor

@AndyButland AndyButland commented Feb 24, 2026

Description

The umbraco-extension template defaults its Umbraco package references to *, which causes CI builds to pull the latest version instead of the version matching the installed template package.

The can cause the problem outlined in #21889.

To fix I've applied the same JsonPathUpdateValue MSBuild fix that was added for the umbraco project template in #13481 — updating $.symbols.UmbracoVersion.defaultValue from * to $(PackageVersion) during dotnet pack

Testing

Firstly run the following to install a new extension project:

dotnet new install Umbraco.Templates::17.2.0
dotnet new umbraco-extension --name TestExtension
cd .\TestExtension\
code .

Open up TestExtension.csproj and note the project references all use "*":

<ItemGroup>
  <PackageReference Include="Umbraco.Cms.Web.Website" Version="*" />
  <PackageReference Include="Umbraco.Cms.Web.Common" Version="*" />
  <PackageReference Include="Umbraco.Cms.Api.Common" Version="*" />
  <PackageReference Include="Umbraco.Cms.Api.Management" Version="*" />
</ItemGroup>

Now run a dotnet pack from this PR. Perhaps the easiest way is save the *.nupkg files generated from this PR into a local folder.

Delete the TestExtension folder and run:

cd ../
dotnet new install Umbraco.Templates::17.3.0--rc.preview.109.g8c069b7 --nuget-source c:\repos\nuget\Umbraco.Templates.17.3.0--rc.preview.109.g8c069b7.nupkg
dotnet new umbraco-extension --name TestExtension
cd .\TestExtension\
code .

Open up TestExtension.csproj and note the project references all use the matching version:

<ItemGroup>
  <PackageReference Include="Umbraco.Cms.Web.Website" Version="17.3.0--rc.preview.109.g8c069b7" />
  <PackageReference Include="Umbraco.Cms.Web.Common" Version="17.3.0--rc.preview.109.g8c069b7" />
  <PackageReference Include="Umbraco.Cms.Api.Common" Version="17.3.0--rc.preview.109.g8c069b7" />
  <PackageReference Include="Umbraco.Cms.Api.Management" Version="17.3.0--rc.preview.109.g8c069b7" />
</ItemGroup>

Copilot AI review requested due to automatic review settings February 24, 2026 15:34
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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 updates the MSBuild target in Umbraco.Templates.csproj to dynamically set the UmbracoVersion symbol's default value to the current package version during the build process. This ensures that the .NET templates use the correct Umbraco version by default when developers create new projects or extensions.

Changes:

  • Adds a JsonPathUpdateValue task to update the UmbracoVersion symbol's defaultValue in template.json files during the build

Copy link
Copy Markdown
Member

@Zeegaan Zeegaan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🚀
Thank you for the very detailed testing steps 💪

@Zeegaan Zeegaan enabled auto-merge (squash) February 25, 2026 01:16
@Zeegaan Zeegaan merged commit d3b3661 into main Feb 25, 2026
31 checks passed
@Zeegaan Zeegaan deleted the v17/bugfix/fix-version-for-extension-template branch February 25, 2026 01:31
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.

3 participants