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

Improve the handling of platform-suffixed target frameworks #306

Merged
merged 1 commit into from
Feb 19, 2023

Conversation

kzu
Copy link
Member

@kzu kzu commented Feb 18, 2023

We previously (ab)used the TargetFrameworkMoniker of a project as a default/fallback target framework to use whenever the TargetFramework metadata was not present for a particular PackageFile.

This broke down in .NET5+ when platform-suffixed TFs such as "net7.0-windows" now need the target platform version, in addition to the TF< which, furthermore, can no longer be recreated as a nuget framework from the TFM alone, since it also contains the TargetPlatformIdentifier.

So rather than complicating the previous single metadata value with three (TFM, TPM and a boolean on whether the original TF had a platform suffix or not), we instead normalize this up-front in all projects via a new target, and set this as PackTargetFramework. We then proceed to use this in a new more intention-revealing metadata item, DefaultTargetFramework, which is now much more obvious than "leveraging" the TFM name.

@kzu kzu added the enhancement New feature or request label Feb 18, 2023
@kzu kzu force-pushed the dev/tf-platform branch 3 times, most recently from 646547d to 74b4a21 Compare February 19, 2023 03:55
We previously (ab)used the TargetFrameworkMoniker of a project as a default/fallback target framework to use whenever the TargetFramework metadata was not present for a particular PackageFile.

This broke down in .NET5+ when platform-suffixed TFs such as "net7.0-windows" now need the target platform version, in addition to the TF< which, furthermore, can no longer be recreated as a nuget framework from the TFM alone, since it also contains the TargetPlatformIdentifier.

So rather than complicating the previous single metadata value with *three* (TFM, TPM and a boolean on whether the original TF had a platform suffix or not), we instead normalize this up-front in all projects via a new target, and set this as PackTargetFramework. We then proceed to use this in a new more intention-revealing metadata item, DefaultTargetFramework, which is now much more obvious than "leveraging" the TFM name.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant