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

A better way to check the framework name. #166

Merged
merged 1 commit into from
Nov 15, 2022

Conversation

qinzhen353
Copy link

No description provided.

@qinzhen353
Copy link
Author

@arunkm could you please have a look?

RuntimeInformation.FrameworkDescription.Contains(".NET 5") || RuntimeInformation.FrameworkDescription.Contains(".NET 6");
// For .Net Framework, the framework name is like ".NET Framework 4.x.x.x", and uses Net Framework Assembly
// For .Net Core and .Net, the framework name is like ".NET Core 3.x.x" or ".NET 5.x.x", and use Net Core Assembly
private static readonly bool IsNetCore = !RuntimeInformation.FrameworkDescription.StartsWith(".NET Framework");

Choose a reason for hiding this comment

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

https://docs.microsoft.com/en-us/dotnet/api/system.runtime.interopservices.runtimeinformation.frameworkdescription?view=net-6.0#remarks
It seems ".NET Native" is also a possible value for FrameworkDescription. Suggest filter out ".NET Native" as well.

This was referenced Nov 14, 2022
@arunkm arunkm merged commit faf85de into microsoft:master Nov 15, 2022
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.

6 participants