8000 Improve target framework reporting by plioi · Pull Request #330 · fixie/fixie · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Improve target framework reporting #330

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

Merged
merged 3 commits into from
Aug 9, 2024
Merged

Conversation

plioi
Copy link
Contributor
@plioi plioi commented Aug 9, 2024

Reports wanting to output the target framework of the test assembly have historically accessed TestEnvironment.TargetFramework which has only approximated the value by looking up the insufficient TargetFrameworkAttribute in the assembly's metadata. This results in strings such as ".NETCoreApp,Version=v8.0" where users would expect and prefer "net8.0" as appears literally in the csproj. This assembly metadata is also "lossy" with respect to less common target framework monikers like "net8.0-windows", where the OS suffix information would be lost.

This PR improves the values of TestEnvironment.TargetFramework in two ways:

  1. Since dotnet fixie has 100% accurate access to the values in the csproj, we use this value verbatim during console runs.
  2. When we are not running through dotnet fixie (ie VS Test Explorer), we fall back to the TargetFrameworkAttribute but are willing to simplify that string to "netX.Y" format when the more verbose string has an obvious transformation available. If TargetFrameworkAttribute has some other format, it is allowed to pass through unaltered. This can be "lossy" with respect to things like the optional OS suffix, but is the best available value. Note that the target framework name that appears in VS Test Explorer's own tree of tests is exactly as lossy independent of test framework, and likely for the same reason.

plioi added 3 commits August 9, 2024 14:00
…work from csproj when available, and when falling back to the TargetFrameworkAttribute still makes an effort to rephrase that attribute's value in "netX.Y" format.
…ct.Name (netX.Y)") instead of assuming the `dotnet fixie` command will do so.
@plioi plioi merged commit 8916e4e into main Aug 9, 2024
1 check passed
@plioi plioi deleted the improve-target-framework-reporting branch August 9, 2024 20:51
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.

1 participant
0