Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use version range on project references #14719

Merged
merged 1 commit into from
Dec 1, 2023

Conversation

ronaldbarendse
Copy link
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
14 checks passed
@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