Remove dependency on Nuget.Frameworks#4693
Merged
Merged
Conversation
nohwnd
commented
Sep 22, 2023
| Version = "4.7.1.0", | ||
| ShortName = "net471", | ||
| }, | ||
| [".NETFramework,Version=v4.7.2"] = new Framework |
nohwnd
commented
Sep 25, 2023
| "Microsoft.CodeCoverage" = 59; | ||
| "Microsoft.NET.Test.Sdk" = 16; | ||
| "Microsoft.TestPlatform" = 607; | ||
| "Microsoft.TestPlatform" = 605; |
Member
Author
There was a problem hiding this comment.
$path = "S:\p\vstest3\artifacts\packages\Debug\Shipping"; (ls $path -re -fo | where { $_.FullName -notlike "*Symbols*" -and $_.Name -eq "Nuget.Frameworks.dll" } | % fullName) -replace [regex]::escape($path)
\Microsoft.TestPlatform.17.8.0-dev\tools\net462\Common7\IDE\Extensions\TestPlatform\NuGet.Frameworks.dll
\Microsoft.TestPlatform.17.8.0-dev\tools\net462\Common7\IDE\Extensions\TestPlatform\TestHostNet\NuGet.Frameworks.dll
\Microsoft.TestPlatform.CLI.17.8.0-dev\contentFiles\any\netcoreapp3.1\NuGet.Frameworks.dll
\Microsoft.TestPlatform.CLI.17.8.0-dev\contentFiles\any\netcoreapp3.1\TestHostNetFramework\NuGet.Frameworks.dll
\Microsoft.TestPlatform.Portable.17.8.0-dev\tools\net462\NuGet.Frameworks.dll
\Microsoft.TestPlatform.Portable.17.8.0-dev\tools\netcoreapp3.1\NuGet.Frameworks.dll
\Microsoft.TestPlatform.Portable.17.8.0-dev\tools\netcoreapp3.1\TestHostNetFramework\NuGet.Frameworks.dllwhich is count reduction by 2, 2 and 3 just like here.
nohwnd
commented
Sep 25, 2023
| ~static Microsoft.VisualStudio.TestPlatform.ObjectModel.Resources.CommonResources.SourceIncompatible.get -> string | ||
| Microsoft.VisualStudio.TestPlatform.ObjectModel.DirectoryBasedTestDiscovererAttribute | ||
| Microsoft.VisualStudio.TestPlatform.ObjectModel.DirectoryBasedTestDiscovererAttribute.DirectoryBasedTestDiscovererAttribute() -> void | ||
| Microsoft.VisualStudio.TestPlatform.ObjectModel.Framework.FrameworkName.get -> string! |
nohwnd
commented
Sep 25, 2023
|
|
||
| parameters.TryGetValue(DefaultLoggerParameterNames.TargetFramework, out _targetFramework); | ||
| _targetFramework = !_targetFramework.IsNullOrEmpty() ? NuGetFramework.Parse(_targetFramework).GetShortFolderName() : _targetFramework; | ||
| _targetFramework = Framework.FromString(_targetFramework)?.ShortName ?? _targetFramework; |
Member
Author
There was a problem hiding this comment.
This returns null when it gets null or whitespace. The original check was unnecessary.
Evangelink
approved these changes
Sep 25, 2023
Evangelink
approved these changes
Sep 25, 2023
nohwnd
commented
Sep 25, 2023
| { | ||
| // .NETPortable4.5 for example, is not a valid framework | ||
| // and this will throw. | ||
| shortName = nugetFramework.GetShortFolderName(); |
Member
Author
There was a problem hiding this comment.
This throws in some cases when the framework is invalid, parsing will return it as Unsupported, but for example if we construct Portable 4.5 and don't specify Profile, it will construct it as supported, but throw when we ask for short name. We use short name as folder for logs, which we figure out when we have a "valid" runtime identifier, so keeping this null should be okay, we check for it in all the places where we use it, and supply the original value.
This was referenced Jul 6, 2026
Open
Open
Open
Open
Open
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Remove dependency on Nuget.Frameworks by copying the relevant code into the repository and changing namespace. The Nuget.Frameworks types were not exposed in our public API directly, but we are relying on the functionality, to parse things like net5.0, net472, or any of similar framework shorthands. We also rely on all the frameworks not being explicitly stated, e.g. net11.0 or any such verison of .NET that does not exist yet.
Replace #2544
Fix #3154
The risk here is that someone is relying on us shipping Nuget.Frameworks into the bin, and not providing it themselves.
The newly added public api should not cause issues for the existing loggers because they ship together with vstest.console.