-
Notifications
You must be signed in to change notification settings - Fork 340
Remove dependency on Nuget.Frameworks #4693
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
Conversation
Version = "4.7.1.0", | ||
ShortName = "net471", | ||
}, | ||
[".NETFramework,Version=v4.7.2"] = new Framework |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
4.8? 4.8.1, 4.8.2?
@@ -16,13 +16,13 @@ function Verify-Nuget-Packages { | |||
$expectedNumOfFiles = @{ | |||
"Microsoft.CodeCoverage" = 59; | |||
"Microsoft.NET.Test.Sdk" = 16; | |||
"Microsoft.TestPlatform" = 607; | |||
"Microsoft.TestPlatform" = 605; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$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.dll
which is count reduction by 2, 2 and 3 just like here.
@@ -968,3 +968,6 @@ virtual Microsoft.VisualStudio.TestPlatform.ObjectModel.TestObject.ProtectedSetP | |||
~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! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
New public api.
@@ -224,7 +222,7 @@ public void Initialize(TestLoggerEvents events, Dictionary<string, string?> para | |||
} | |||
|
|||
parameters.TryGetValue(DefaultLoggerParameterNames.TargetFramework, out _targetFramework); | |||
_targetFramework = !_targetFramework.IsNullOrEmpty() ? NuGetFramework.Parse(_targetFramework).GetShortFolderName() : _targetFramework; | |||
_targetFramework = Framework.FromString(_targetFramework)?.ShortName ?? _targetFramework; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This returns null when it gets null or whitespace. The original check was unnecessary.
{ | ||
// .NETPortable4.5 for example, is not a valid framework | ||
// and this will throw. | ||
shortName = nugetFramework.GetShortFolderName(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
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.