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

Remove netstandard1.x dependencies #5191

Closed
5 changes: 5 additions & 0 deletions eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
<UsingToolXliff>true</UsingToolXliff>
<!-- Opt-in to Arcade tools for building VSIX projects. -->
<UsingToolVSSDK>true</UsingToolVSSDK>
<!-- Prohibit the usage of .NET Standard 1.x dependencies. -->
<FlagNetStandard1XDependencies Condition="'$(DotNetBuildSourceOnly)' == 'true'">true</FlagNetStandard1XDependencies>
</PropertyGroup>
<PropertyGroup Label="VSTest dependencies">
<CoverletCoverageVersion>1.2.0</CoverletCoverageVersion>
Expand Down Expand Up @@ -51,13 +53,16 @@
<MicrosoftVSTelemetryVersion>17.6.46</MicrosoftVSTelemetryVersion>
<MicrosoftVSUtilitiesInternalVersion>16.3.42</MicrosoftVSUtilitiesInternalVersion>
<MicrosoftVSSDKBuildToolsVersion>17.4.2124</MicrosoftVSSDKBuildToolsVersion>
<MicrosoftWin32RegistryVersion>5.0.0</MicrosoftWin32RegistryVersion>
<NewtonsoftJsonVersion>13.0.1</NewtonsoftJsonVersion>
<NewtonsoftJsonVersion Condition="'$(DotNetBuildSourceOnly)' == 'true'">13.0.3</NewtonsoftJsonVersion>
<SystemCollectionsImmutableVersion>1.5.0</SystemCollectionsImmutableVersion>
<SystemComponentModelCompositionVersion>4.5.0</SystemComponentModelCompositionVersion>
<SystemMemoryVersion>4.5.5</SystemMemoryVersion>
<SystemNetHttpVersion>4.3.4</SystemNetHttpVersion>
<SystemReflectionMetadataVersion>1.6.0</SystemReflectionMetadataVersion>
<SystemSecurityAccessControlVersion>5.0.0</SystemSecurityAccessControlVersion>
<SystemSecurityPrincipalWindowsVersion>5.0.0</SystemSecurityPrincipalWindowsVersion>
<SystemUriVersion>4.3.2</SystemUriVersion>
<TestPlatformExternalsVersion>17.10.0-preview-2-34602-162</TestPlatformExternalsVersion>
<MicrosoftInternalTestPlatformExtensions>17.10.0-preview-2-34602-162</MicrosoftInternalTestPlatformExtensions>
Expand Down
2 changes: 1 addition & 1 deletion eng/verify-nupkgs.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function Verify-Nuget-Packages {
"Microsoft.NET.Test.Sdk" = 15;
"Microsoft.TestPlatform" = 608;
"Microsoft.TestPlatform.Build" = 20;
"Microsoft.TestPlatform.CLI" = 471;
"Microsoft.TestPlatform.CLI" = 478;
"Microsoft.TestPlatform.Extensions.TrxLogger" = 34;
"Microsoft.TestPlatform.ObjectModel" = 92;
"Microsoft.TestPlatform.AdapterUtilities" = 75;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,12 @@
<Reference Include="Microsoft.CSharp" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' != '$(NetFrameworkMinimum)' ">
<PackageReference Include="System.Diagnostics.FileVersionInfo" Version="4.3.0" />
Copy link
Member Author

Choose a reason for hiding this comment

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

This package is very old. Dropping it in order to pick up System.Diagnostics.FileVersionInfo.dll via the implicit netcore app ref.

<PackageReference Include="Microsoft.Win32.Registry" Version="4.0.0" />
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0' or '$(TargetFramework)' == 'netcoreapp3.1'">
<PackageReference Include="Microsoft.Win32.Registry" Version="$(MicrosoftWin32RegistryVersion)" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="System.Reflection.Metadata" Version="1.6.0" />
<ItemGroup Condition="'$(TargetFrameworkIdentifier)' != '.NETCoreApp'">
<PackageReference Include="System.Reflection.Metadata" Version="$(SystemReflectionMetadataVersion)" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,8 @@
<ProjectReference Include="$(RepoRoot)src\Microsoft.TestPlatform.CoreUtilities\Microsoft.TestPlatform.CoreUtilities.csproj" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' ">
<PackageReference Include="System.Security.Principal.Windows" Version="4.0.0" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net6.0' ">
Copy link
Member Author

Choose a reason for hiding this comment

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

Not seeing how this condition would ever be true given <TargetFrameworks>netstandard2.0;$(NetFrameworkMinimum)</TargetFrameworks>. Why can't 5.0 be referenced for all non NetFrameworkMinimum scenarios? This change is needed because there is a package downgrade warning with upgrading Microsoft.Win32.Registry in https://github.com/microsoft/vstest/pull/5191/files#diff-cb0ebd35c90417a3701f998bc4ba8f981bb5fd0c4c0b6f078c722bb73f5f5434R20

Copy link
Member

Choose a reason for hiding this comment

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

On anything newer than .NET 5, this package shouldn't be referenced anymore as the library got moved inbox.

Not seeing how this condition would ever be true given netstandard2.0;$(NetFrameworkMinimum)

This logic adds the latest and previous .NETCoreApp TFMs to all projects:

<!--
CI source build leg: this needs to build the current and previous source build TFM. Both are
necessary as the output of this leg is used in other CI source build legs. Those could be
targeting NetCurrent or NetPrevious hence we must produce both.
-->
<PropertyGroup Condition=" '$(DotNetBuildSourceOnly)' == 'true' and '$(DotNetBuildOrchestrator)' != 'true' ">
<TargetFrameworks>$(NetPrevious);$(NetCurrent)</TargetFrameworks>
</PropertyGroup>
<!--
Source build the product: this is the all up build of the product which needs only NetCurrent
-->
<PropertyGroup Condition=" '$(DotNetBuildSourceOnly)' == 'true' and '$(DotNetBuildOrchestrator)' == 'true' ">
<TargetFrameworks>$(NetCurrent)</TargetFrameworks>
</PropertyGroup>

<PackageReference Include="System.Security.Principal.Windows" Version="5.0.0" />
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
<PackageReference Include="System.Security.Principal.Windows" Version="$(SystemSecurityPrincipalWindowsVersion)" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
<Reference Include="Microsoft.CSharp" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="System.Reflection.Metadata" Version="1.6.0" />
<ItemGroup Condition="'$(TargetFrameworkIdentifier)' != '.NETCoreApp'">
<PackageReference Include="System.Reflection.Metadata" Version="$(SystemReflectionMetadataVersion)" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,6 @@
<NoWarn>$(NoWarn);NU1605</NoWarn>
</PropertyGroup>

<ItemGroup Condition=" '$(TargetFramework)' == '$(NetCoreAppMinimum)' ">
<PackageReference Include="System.Threading.Thread" Version="4.0.0" />
<PackageReference Include="System.Diagnostics.Process" Version="4.1.0" />
<PackageReference Include="System.Diagnostics.TextWriterTraceListener" Version="4.0.0" />
<PackageReference Include="System.Diagnostics.TraceSource" Version="4.0.0" />
<PackageReference Include="System.Runtime.InteropServices.RuntimeInformation" Version="4.0.0" />
<PackageReference Include="System.Runtime.Loader" Version="4.0.0" />
<PackageReference Include="System.Net.Http" Version="$(SystemNetHttpVersion)" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == '$(NetFrameworkMinimum)' ">
<Reference Include="System.Configuration" />
<Reference Include="System" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="$(NewtonsoftJsonVersion)" />
<PackageReference Include="Microsoft.Extensions.DependencyModel" Version="$(MicrosoftExtensionsDependencyModelPackageVersion)" />
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="4.7.1" Condition="'$(DotNetBuildSourceOnly)' != 'true'" />
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="4.7.1" Condition="'$(TargetFrameworkIdentifier)' != '.NETCoreApp'" />
</ItemGroup>
<ItemGroup>
<Compile Update="NullableHelpers.cs">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,16 +69,28 @@
<PackageReference Include="Newtonsoft.Json" Version="$(NewtonsoftJsonVersion)" GeneratePathProperty="true" Condition="'$(TargetFramework)' != 'net472'" />
</ItemGroup>

<!-- Exclude packages that are already inbox in newer .NETCoreApp versions. -->
<ItemGroup Condition="'$(TargetFrameworkIdentifier)' != '.NETCoreApp' or '$(TargetFramework)' == '$(NetCoreAppMinimum)'">
<PackageReference Include="Microsoft.Win32.Registry" Version="$(MicrosoftWin32RegistryVersion)" GeneratePathProperty="true" PrivateAssets="Runtime" />
<PackageReference Include="System.Security.AccessControl" Version="$(SystemSecurityAccessControlVersion)" GeneratePathProperty="true" PrivateAssets="Runtime" />
<PackageReference Include="System.Security.Principal.Windows" Version="$(SystemSecurityPrincipalWindowsVersion)" GeneratePathProperty="true" PrivateAssets="All" />
</ItemGroup>

<Target Name="CopyFiles" AfterTargets="Build">
<ItemGroup>
<MicrosoftCodeCoverageIO Include="$(PkgMicrosoft_CodeCoverage_IO)\lib\netstandard2.0\**\*"></MicrosoftCodeCoverageIO>
<MicrosoftExtensionsDependencyModel Include="$(PkgMicrosoft_Extensions_DependencyModel)\lib\netstandard2.0\*"></MicrosoftExtensionsDependencyModel>
<MicrosoftExtensionsFileSystemGlobbing Include="$(PkgMicrosoft_Extensions_FileSystemGlobbing)\lib\netstandard2.0\*"></MicrosoftExtensionsFileSystemGlobbing>
<NewtonsoftJson Include="$(PkgNewtonsoft_Json)\lib\netstandard2.0\*"></NewtonsoftJson>
<MicrosoftInternalDia Include="$(PkgMicrosoft_Internal_Dia)\tools\netstandard\**\*"></MicrosoftInternalDia>
<SystemComponentModelComposition Include="$(PkgSystem_ComponentModel_Composition)\lib\netstandard2.0\**\*"></SystemComponentModelComposition>
<MicrosoftDiagnosticsNETCoreClient Include="$(PkgMicrosoft_Diagnostics_NETCore_Client)\lib\netstandard2.0\**\*"></MicrosoftDiagnosticsNETCoreClient>
<MicrosoftInternalDia Include="$(PkgMicrosoft_Internal_Dia)\tools\net451\**\*"></MicrosoftInternalDia>
<MicrosoftCodeCoverageIO Include="$(PkgMicrosoft_CodeCoverage_IO)\lib\netstandard2.0\**\*" />
<MicrosoftExtensionsDependencyModel Include="$(PkgMicrosoft_Extensions_DependencyModel)\lib\netstandard2.0\*" />
<MicrosoftExtensionsFileSystemGlobbing Include="$(PkgMicrosoft_Extensions_FileSystemGlobbing)\lib\netstandard2.0\*" />
<NewtonsoftJson Include="$(PkgNewtonsoft_Json)\lib\netstandard2.0\*" />
<MicrosoftInternalDia Include="$(PkgMicrosoft_Internal_Dia)\tools\netstandard\**\*" />
<SystemComponentModelComposition Include="$(PkgSystem_ComponentModel_Composition)\lib\netstandard2.0\**\*" />
<MicrosoftDiagnosticsNETCoreClient Include="$(PkgMicrosoft_Diagnostics_NETCore_Client)\lib\netstandard2.0\**\*" />
<MicrosoftInternalDia Include="$(PkgMicrosoft_Internal_Dia)\tools\net451\**\*" />

<SystemSecurityAccessControl Include="$(PkgSystem_Security_AccessControl)\runtimes\win\lib\netcoreapp2.0\*" Condition="'$(PkgSystem_Security_AccessControl)' != ''" />
<SystemSecurityPrincipalWindowsUnix Include="$(PkgSystem_Security_Principal_Windows)\runtimes\unix\lib\netcoreapp2.1\*" Condition="'$(PkgSystem_Security_Principal_Windows)' != ''" />
<SystemSecurityPrincipalWindowsWin Include="$(PkgSystem_Security_Principal_Windows)\runtimes\win\lib\netcoreapp2.1\*" Condition="'$(PkgSystem_Security_Principal_Windows)' != ''" />
<MicrosoftWin32Registry Include="$(PkgMicrosoft_Win32_Registry)\runtimes\win\lib\netstandard2.0\*" Condition="'$(PkgMicrosoft_Win32_Registry)' != ''" />
</ItemGroup>

<Copy SourceFiles="@(MicrosoftCodeCoverageIO)" DestinationFiles="$(OutDir)\Microsoft.CodeCoverage.IO\%(RecursiveDir)%(Filename)%(Extension)" Condition="'$(DotNetBuildSourceOnly)' != 'true'" />
Expand All @@ -88,6 +100,11 @@
<Copy SourceFiles="@(SystemComponentModelComposition)" DestinationFiles="$(OutDir)\%(RecursiveDir)%(Filename)%(Extension)" />
<Copy SourceFiles="@(MicrosoftDiagnosticsNETCoreClient)" DestinationFiles="$(OutDir)\Microsoft.Diagnostics.NETCore.Client\%(RecursiveDir)%(Filename)%(Extension)" />
<Copy SourceFiles="@(MicrosoftInternalDia)" DestinationFiles="$(OutDir)\Microsoft.Internal.Dia\%(RecursiveDir)%(Filename)%(Extension)" />

<Copy SourceFiles="@(SystemSecurityAccessControl)" DestinationFiles="$(OutDir)\runtimes\win\lib\netcoreapp2.0\%(RecursiveDir)%(Filename)%(Extension)" Condition="'@(SystemSecurityAccessControl)' != ''" />
<Copy SourceFiles="@(SystemSecurityPrincipalWindowsUnix)" DestinationFiles="$(OutDir)\runtimes\unix\lib\netcoreapp2.1\%(RecursiveDir)%(Filename)%(Extension)" Condition="'@(SystemSecurityPrincipalWindowsUnix)' != ''" />
<Copy SourceFiles="@(SystemSecurityPrincipalWindowsWin)" DestinationFiles="$(OutDir)\runtimes\win\lib\netcoreapp2.1\%(RecursiveDir)%(Filename)%(Extension)" Condition="'@(SystemSecurityPrincipalWindowsWin)' != ''" />
<Copy SourceFiles="@(MicrosoftWin32Registry)" DestinationFiles="$(OutDir)\runtimes\win\lib\netstandard2.0\%(RecursiveDir)%(Filename)%(Extension)" Condition="'@(MicrosoftWin32Registry)' != ''" />
</Target>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@
<file src="netcoreapp3.1\vstest.console.deps.json" target="contentFiles\any\netcoreapp3.1" />
<file src="netcoreapp3.1\vstest.console.runtimeconfig.json" target="contentFiles\any\netcoreapp3.1" />

<file src="netcoreapp3.1\runtimes\unix\lib\netcoreapp2.1\System.Security.Principal.Windows.dll" target="contentFiles\any\netcoreapp3.1\runtimes\unix\lib\netcoreapp2.1" />
<file src="netcoreapp3.1\runtimes\win\lib\netcoreapp2.0\System.Security.AccessControl.dll" target="contentFiles\any\netcoreapp3.1\runtimes\win\lib\netcoreapp2.0" />
<file src="netcoreapp3.1\runtimes\win\lib\netcoreapp2.1\System.Security.Principal.Windows.dll" target="contentFiles\any\netcoreapp3.1\runtimes\win\lib\netcoreapp2.1" />
<file src="netcoreapp3.1\runtimes\win\lib\netstandard2.0\Microsoft.Win32.Registry.dll" target="contentFiles\any\netcoreapp3.1\runtimes\win\lib\netstandard2.0" />
<file src="netcoreapp3.1\Microsoft.Win32.Registry.dll" target="contentFiles\any\netcoreapp3.1\lib\netstandard2.0" />
Copy link
Member

Choose a reason for hiding this comment

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

adding the missing dll that vstest.console is complaining about, but that change looks very dubious.


<!-- Extensions -->
<file src="netcoreapp3.1\DumpMinitool.exe" target="contentFiles\any\netcoreapp3.1\Extensions\dump" />
<file src="netcoreapp3.1\DumpMinitool.exe.config" target="contentFiles\any\netcoreapp3.1\Extensions\dump" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,28 +62,34 @@
<PackageReference Include="Microsoft.Extensions.DependencyModel" Version="$(MicrosoftExtensionsDependencyModelPackageVersion)" GeneratePathProperty="true"/>
<PackageReference Include="Microsoft.Extensions.FileSystemGlobbing" Version="$(MicrosoftExtensionsFileSystemGlobbingVersion)" GeneratePathProperty="true"/>
<PackageReference Include="Newtonsoft.Json" Version="$(NewtonsoftJsonVersion)" GeneratePathProperty="true"/>
<PackageReference Include="Microsoft.Internal.Dia" Version="$(TestPlatformMSDiaVersion)" PrivateAssets="All" GeneratePathProperty="true" />
</ItemGroup>

<!-- Exclude packages that are already inbox in newer .NETCoreApp versions. -->
<ItemGroup Condition="'$(TargetFrameworkIdentifier)' != '.NETCoreApp'">
<PackageReference Include="System.Collections.Immutable" Version="$(SystemCollectionsImmutableVersion)" GeneratePathProperty="true"/>
<PackageReference Include="System.Reflection.Metadata" Version="$(SystemReflectionMetadataVersion)" GeneratePathProperty="true"/>
<PackageReference Include="Microsoft.Internal.Dia" Version="$(TestPlatformMSDiaVersion)" PrivateAssets="All" GeneratePathProperty="true" />
</ItemGroup>

<Target Name="CopyFiles" AfterTargets="Build">
<ItemGroup>
<MicrosoftCodeCoverageIO Include="$(PkgMicrosoft_CodeCoverage_IO)\lib\netstandard2.0\**\*"></MicrosoftCodeCoverageIO>
<MicrosoftExtensionsDependencyModel Include="$(PkgMicrosoft_Extensions_DependencyModel)\lib\netstandard2.0\*"></MicrosoftExtensionsDependencyModel>
<MicrosoftExtensionsFileSystemGlobbing Include="$(PkgMicrosoft_Extensions_FileSystemGlobbing)\lib\netstandard2.0\*"></MicrosoftExtensionsFileSystemGlobbing>
<NewtonsoftJson Include="$(PkgNewtonsoft_Json)\lib\netstandard2.0\*"></NewtonsoftJson>
<SystemCollectionsImmutable Include="$(PkgSystem_Collections_Immutable)\lib\netstandard2.0\*"></SystemCollectionsImmutable>
<SystemReflectionMetadata Include="$(PkgSystem_Reflection_Metadata)\lib\netstandard2.0\*"></SystemReflectionMetadata>
<MicrosoftInternalDia Include="$(PkgMicrosoft_Internal_Dia)\tools\net451\**\*"></MicrosoftInternalDia>
<MicrosoftCodeCoverageIO Include="$(PkgMicrosoft_CodeCoverage_IO)\lib\netstandard2.0\**\*" />
<MicrosoftExtensionsDependencyModel Include="$(PkgMicrosoft_Extensions_DependencyModel)\lib\netstandard2.0\*" />
<MicrosoftExtensionsFileSystemGlobbing Include="$(PkgMicrosoft_Extensions_FileSystemGlobbing)\lib\netstandard2.0\*" />
<NewtonsoftJson Include="$(PkgNewtonsoft_Json)\lib\netstandard2.0\*" />
<MicrosoftInternalDia Include="$(PkgMicrosoft_Internal_Dia)\tools\net451\**\*" />

<SystemCollectionsImmutable Include="$(PkgSystem_Collections_Immutable)\lib\netstandard2.0\*" Condition="'$(PkgSystem_Collections_Immutable)' != ''" />
<SystemReflectionMetadata Include="$(PkgSystem_Reflection_Metadata)\lib\netstandard2.0\*" Condition="'$(PkgSystem_Reflection_Metadata)' != ''" />
</ItemGroup>

<Copy SourceFiles="@(MicrosoftCodeCoverageIO)" DestinationFiles="$(OutDir)\Microsoft.CodeCoverage.IO\%(RecursiveDir)%(Filename)%(Extension)" />
<Copy SourceFiles="@(MicrosoftExtensionsDependencyModel)" DestinationFiles="$(OutDir)\%(RecursiveDir)%(Filename)%(Extension)" />
<Copy SourceFiles="@(MicrosoftExtensionsFileSystemGlobbing)" DestinationFiles="$(OutDir)\%(RecursiveDir)%(Filename)%(Extension)" />
<Copy SourceFiles="@(NewtonsoftJson)" DestinationFiles="$(OutDir)\%(RecursiveDir)%(Filename)%(Extension)" />
<Copy SourceFiles="@(SystemCollectionsImmutable)" DestinationFiles="$(OutDir)\%(RecursiveDir)%(Filename)%(Extension)" />
<Copy SourceFiles="@(SystemReflectionMetadata)" DestinationFiles="$(OutDir)\%(RecursiveDir)%(Filename)%(Extension)" />
<Copy SourceFiles="@(MicrosoftInternalDia)" DestinationFiles="$(OutDir)\Microsoft.Internal.Dia\%(RecursiveDir)%(Filename)%(Extension)" />

<Copy SourceFiles="@(SystemCollectionsImmutable)" DestinationFiles="$(OutDir)\%(RecursiveDir)%(Filename)%(Extension)" Condition="'@(SystemCollectionsImmutable)' != ''" />
<Copy SourceFiles="@(SystemReflectionMetadata)" DestinationFiles="$(OutDir)\%(RecursiveDir)%(Filename)%(Extension)" Condition="'@(SystemReflectionMetadata)' != ''" />
</Target>
</Project>
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netcoreapp3.1;net462</TargetFrameworks>
<TargetFrameworks>$(NetCoreAppMinimum);$(NetFrameworkMinimum)</TargetFrameworks>
</PropertyGroup>

<PropertyGroup>
Expand Down
Loading