Skip to content

Use version range on project references#14719

Merged
bergmania merged 1 commit intorelease/13.0from
v12/feature/projectreference-versionrange
Dec 1, 2023
Merged

Use version range on project references#14719
bergmania merged 1 commit intorelease/13.0from
v12/feature/projectreference-versionrange

Conversation

@ronaldbarendse
Copy link
Copy Markdown
Contributor

Prerequisites

  • I have added steps to test this contribution in the description below

Description

When the current solution gets packaged (using dotnet pack), all project references will be converted to package dependencies that only specify the minimum version, for example: Umbraco.Cms 12.1.1 depends on Umbraco.Cms.Targets >= 12.1.1. This allows other dependencies to (accidentally) update any of the transitive Umbraco dependencies to a next major version, which will most likely cause compilation or (worst-case) runtime errors.

This can be prevented by setting the maximum version to the next major version as version range. Because the version is automatically generated and dependencies are specified in ProjectReferences, this version range must be dynamically set as well (better support for this has already been requested on the NuGet issue tracker). This PR contains an MSBuild target that updates the generated project reference version to use a version range, so when packaging version 12.1.0--rc.preview.96.gfec51a9, the dependency version is automatically updated to [12.1.0--rc.preview.96.gfec51a9, 13).

Testing can be done by verifying whether the Umbraco dependencies in the NuGet packages contain the version range, either by inspecting the build artifacts or running dotnet pack -c Release -o build.out locally.

@ronaldbarendse ronaldbarendse changed the base branch from contrib to release/13.0 November 21, 2023 13:12
@ronaldbarendse ronaldbarendse added dependencies Pull requests that update a dependency file type/improvement labels Nov 23, 2023
@bergmania bergmania merged commit 50baed1 into release/13.0 Dec 1, 2023
@bergmania bergmania deleted the v12/feature/projectreference-versionrange branch December 1, 2023 10:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file type/improvement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants