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

Add .NET 9 and .NET 10 TFMs to FrameworkConstants #6262

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

zivkan
Copy link
Member

@zivkan zivkan commented Feb 11, 2025

Bug

Fixes: NuGet/Home#14067

Description

  • Add FrameworkConstants.CommonFrameworks fields for .NET 9 and .NET 10
  • Change test to make sure any future constants added have the zero-allocation parsing implemented.

PR Checklist

  • Meaningful title, helpful description and a linked NuGet/Home issue
  • Added tests
  • Link to an issue or pull request to update docs if this PR changes settings, environment variables, new feature, etc. n/a

@zivkan zivkan requested a review from a team as a code owner February 11, 2025 07:19
@@ -189,6 +190,8 @@ public static readonly NuGetFramework NetCoreApp31
public static readonly NuGetFramework Net60 = new NuGetFramework(FrameworkIdentifiers.NetCoreApp, Version6);
public static readonly NuGetFramework Net70 = new NuGetFramework(FrameworkIdentifiers.NetCoreApp, Version7);
public static readonly NuGetFramework Net80 = new NuGetFramework(FrameworkIdentifiers.NetCoreApp, Version8);
public static readonly NuGetFramework Net90 = new NuGetFramework(FrameworkIdentifiers.NetCoreApp, Version9);
public static readonly NuGetFramework Net10_0 = new NuGetFramework(FrameworkIdentifiers.NetCoreApp, Version10);
Copy link
Member Author

Choose a reason for hiding this comment

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

I'm open to suggestions for alternative names.

I didn't like Net100 because .NET Framework 4.7.2 is net472, making Net100 sound like 1.0.0, rather than 10.0.

We could use Net10, and stop appending anything to represent the final .0 going forward. There's no constant for .NET Framework 1.0, and the constants for 2.0, 3.0, and 4.0 don't have the final 0, meaning if .NET makes it all the way to versions .NET 20, .NET 30 and .NET 40, there won't be name clashes. But it will be confusing why Net11 is .NET Framework 1.0 while Net10 is .NET (CoreApp) 10.0.

So I created this pull request using Net10_0 because it's similar to the compile constants NET10_0 and NET10_0_OR_GREATER that the .NET SDK adds. However, it's inconsistent with all the other constants here.

We could break APIs and remove all the trailing 0 from all the frameworks, and add _ to all the .NET Framework, .NET Standard and .NET Core App TFMs that have values other than .0. But breaking all these APIs aren't a perfect solution either.

So, no perfect solution. I made a call and need feedback if anyone disagrees and thinks we should do something different.

Copy link
Contributor

Choose a reason for hiding this comment

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

My opinion is that we should just following the existing naming convention, version with the dot removed. I'm surprised there's no XML doc comment on these, telling people that Net80 represents net8.0. That might be worth adding? The underscore doesn't look right to me unless we update them all which of course is a breaking change.

We could add all of the older ones as Net8_0 and keep the old ones.

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.

Add Net90 to FrameworkConstants.CommonFrameworks
3 participants