Skip to content

Hotfix: create and pack empty file to add TFM dependency to Umbraco.Cms and Umbraco.Cms.Targets#13502

Closed
ronaldbarendse wants to merge 1 commit intorelease/11.0from
v11/hotfix/tfm-dependency
Closed

Hotfix: create and pack empty file to add TFM dependency to Umbraco.Cms and Umbraco.Cms.Targets#13502
ronaldbarendse wants to merge 1 commit intorelease/11.0from
v11/hotfix/tfm-dependency

Conversation

@ronaldbarendse
Copy link
Copy Markdown
Contributor

Prerequisites

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

Description

PR #13475 added an MSBuild target that added an empty file in a framework specific folder to the Umbraco.Cms and Umbraco.Cms.Targets meta-packages, so they can only be installed into projects with a compatible TFM.

This worked fine if the package was created using dotnet pack, but the target wasn't executed when doing a separate dotnet build and dotnet pack --no-build (as done by the build pipeline), causing the file to not be included.

This fixes this problem and only executes the target when the NuGet package is actually created, so it also doesn't have to write the empty file when only doing a build (reducing disk I/O).

@ronaldbarendse
Copy link
Copy Markdown
Contributor Author

With this in place, trying to install Umbraco.Cms (or Umbraco.Cms.Targets) version 11.0.0 into a project with an incompatible TFM (e.g. net6.0) will produce the following error: NU1202: Package Umbraco.Cms 11.0.0 is not compatible with net6.0 (.NETCoreApp,Version=v6.0). Package Umbraco.Cms 11.0.0 supports: net7.0 (.NETCoreApp,Version=v7.0).

Otherwise it will install successfully, but not pull any dependencies into the project (as those are .NET 7 specific) and probably result in some confusion as to why Umbraco isn't working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants