Skip to content

Commit

Permalink
Drop unsupported frameworks (#10565)
Browse files Browse the repository at this point in the history
Update to net8 and net9.
  • Loading branch information
nohwnd authored Jan 23, 2025
1 parent 79742e5 commit f70bb54
Show file tree
Hide file tree
Showing 227 changed files with 2,378 additions and 2,314 deletions.
67 changes: 62 additions & 5 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<Version Condition="'$(Version)' == ''">$(TPVersionPrefix)-dev</Version>
<!-- Override the AssemblyVersion as 15.0.0 since protocol depends on this version for serialization. This is also defined in build script. -->
<AssemblyVersion Condition="'$(AssemblyVersion)' == ''">15.0.0</AssemblyVersion>
<!-- Auto generating binding redirects breaks testhost when running under netcoreapp3.1 vstest.console as .NET Framework net462. -->
<!-- Auto generating binding redirects breaks testhost when running under net8.0 vstest.console as .NET Framework net462. -->
<AutoGenerateBindingRedirects>false</AutoGenerateBindingRedirects>
<!-- But not autogenerating binding redirects also breaks build occasionally, so we tell MSBuild to unify assembly versions,
without outputting binding redirectes. -->
Expand All @@ -52,15 +52,72 @@
<PropertyGroup>
<!-- Naming is based on dotnet/runtime one -->
<NetFrameworkMinimum>net462</NetFrameworkMinimum>
<!-- When not building from source, hardcode the NetCurrent TFM value as it is hardcoded in a number of places, i.e. nuspec files. -->
<NetCurrent Condition="'$(DotNetBuildSourceOnly)' != 'true'">net9.0</NetCurrent>
<NetCoreAppMinimum>netcoreapp3.1</NetCoreAppMinimum>
<NetCoreAppMinimum>net8.0</NetCoreAppMinimum>
<NetCoreAppStable>net9.0</NetCoreAppStable>
<!--
Arcade is making things hard to work with. This property is unset when its value is equal to NetMinimum.
https://github.com/dotnet/arcade/blob/66c9c5397d599af40f2a94989241944f5a73442a/src/Microsoft.DotNet.Arcade.Sdk/tools/TargetFrameworkDefaults.props#L16-L18
Because I don't want to complexify further the logic on VSTest just for that, I will set it to NetMinimum.
-->
-->
<NetPrevious Condition=" $(NetPrevious) == '' ">$(NetMinimum)</NetPrevious>

<!--
vstest.console.exe is shipped with VS, we can use the version of .NET Framework that VS requires to run (this might differ from the version is requires to install).
https://learn.microsoft.com/en-us/visualstudio/releases/2022/system-requirements#additional-requirements-and-guidance
-->
<NetFrameworkRunnerTargetFramework>net48</NetFrameworkRunnerTargetFramework>
<!--
vstest.console.dll or datacollector.dll are shipped with .NET SDK, target the tfms into which we insert.
-->
<NetSDKTargetFramework>$(NetCoreAppStable)</NetSDKTargetFramework>
<!--
vstest.console.dll and datacollector.dll are shipped in TestPlatform.Portable package, that should support
the oldest currently supported .NET, because we don't know with which runtime it will be used.
vstest.console.exe and datacollector.exe are shipped in there as well, choose the lowest version of
.NET Frameowork to support as well.
-->
<NetPortableTargetFrameworks>$(NetCoreAppMinimum)</NetPortableTargetFrameworks>
<NetRunnerTargetFrameworks>$(NetSDKTargetFramework);$(NetPortableTargetFrameworks)</NetRunnerTargetFrameworks>
<RunnerTargetFrameworks>$(NetFrameworkRunnerTargetFramework);$(NetRunnerTargetFrameworks)</RunnerTargetFrameworks>

<!--
-->
<BundledExtensionTargetFrameworks>$(RunnerTargetFrameworks)</BundledExtensionTargetFrameworks>
<!--
Extensions that are shipped as standalone packages need to be netstandard2.0, because we don't know on which runtime
we will run.
This is the same for bundled extensions that are shipped together with vstest.console or datacollector. In ideal case
they would not need netstandard, but we load the same dll into .NET and .NET Framework datacollector.
So the need to target netstandard2.0 as well.
-->
<ExtensionTargetFrameworks>netstandard2.0</ExtensionTargetFrameworks>

<!--
Testhosts need to run on all currently supported target frameworks and newer.
https://learn.microsoft.com/en-us/visualstudio/releases/2022/compatibility#-visual-studio-2022-support-for-net-development
https://dotnet.microsoft.com/en-us/platform/support/policy
https://learn.microsoft.com/en-us/lifecycle/products/microsoft-net-framework
Currently that is net8 (until November 10, 2026) and .NET Framework 4.6.2 (until Jan 12, 2027).
-->
<TestHostMinimumTargetFrameworks>$(NetCoreAppMinimum);$(NetFrameworkMinimum)</TestHostMinimumTargetFrameworks>
<!--
Testhost needs to support every target framework from the minimum, and it also needs to build
all the .NET Framework target frameworks that are newer than the minimum, because we ship each of those
executables separately, and use it to load dlls into specific version of .NET Framework based on user
settings.
https://learn.microsoft.com/en-us/dotnet/standard/frameworks#supported-target-frameworks
-->
<TestHostAllTargetFrameworks>$(TestHostMinimumTargetFrameworks);net47;net471;net472;net48;net481</TestHostAllTargetFrameworks>

<!--
Library that is loaded by others and by us. We don't know where it will run (e.b. TranslationLayer),
we need to support all frameworks from minimum, and also netstandard2.0.
-->
<LibraryTargetFrameworks>$(NetFrameworkMinimum);netstandard2.0</LibraryTargetFrameworks>
</PropertyGroup>

<!-- Build & pack config -->
Expand Down
6 changes: 3 additions & 3 deletions azure-pipelines-official.yml
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ extends:
enabled: true
pool:
name: $(DncEngInternalBuildPool)
image: 1es-windows-2022
image: windows.vs2022preview.amd64
os: windows
customBuildTags:
- ES365AIMigrationTooling
Expand All @@ -151,7 +151,7 @@ extends:
timeoutInMinutes: 120
pool:
name: $(DncEngInternalBuildPool)
image: 1es-windows-2022
image: windows.vs2022preview.amd64
os: windows
steps:
# This steps help to understand versions of .NET runtime installed on the machine,
Expand Down Expand Up @@ -255,7 +255,7 @@ extends:
- ${{ pool.os }}
pool:
name: $(DncEngInternalBuildPool)
image: 1es-windows-2022
image: windows.vs2022preview.amd64
os: windows
steps:
# The template job needs a log, otherwise it writes a warning. We can disable log uploading only for
Expand Down
24 changes: 15 additions & 9 deletions eng/SourceBuildPrebuiltBaseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,24 @@

<UsageData>
<IgnorePatterns>
<!-- Caused by dependency on System.ComponentModel.Composition.4.5.0. This version is overridden in full source-build. -->
<!--
These dependencies are replaced with their live versions when building in real source build.
https://github.com/dotnet/dotnet/blob/d966d07fa1f7a5bdddbb9aa39603f1a9c739eb1d/repo-projects/vstest.proj#L13
-->
<!-- Caused by dependency on System.ComponentModel.Composition.8.0.0. This version is overridden in full source-build. -->
<UsagePattern IdentityGlob="Microsoft.NETCore.Platforms/2.0.0" />
<!-- This version is overridden in full source-build. -->
<UsagePattern IdentityGlob="System.ComponentModel.Composition/4.5.0" />
<!-- Caused by dependency on System.ComponentModel.Composition.4.5.0. This version is overridden in full source-build. -->
<UsagePattern IdentityGlob="System.Security.AccessControl/4.5.0" />
<!-- Caused by dependency on System.ComponentModel.Composition.4.5.0. This version is overridden in full source-build. -->
<UsagePattern IdentityGlob="System.Security.Permissions/4.5.0" />
<!-- Caused by dependency on System.ComponentModel.Composition.4.5.0. This version is overridden in full source-build. -->
<UsagePattern IdentityGlob="System.Security.Principal.Windows/4.5.0" />
<UsagePattern IdentityGlob="Microsoft.Diagnostics.NETCore.Client/0.2.452401" />
<UsagePattern IdentityGlob="System.ComponentModel.Composition/8.0.0" />
<!-- Caused by dependency on System.ComponentModel.Composition.8.0.0. This version is overridden in full source-build. -->
<UsagePattern IdentityGlob="System.Security.AccessControl/8.0.0" />
<!-- Caused by dependency on System.ComponentModel.Composition.8.0.0. This version is overridden in full source-build. -->
<UsagePattern IdentityGlob="System.Security.Permissions/8.0.0" />
<!-- Caused by dependency on System.ComponentModel.Composition.8.0.0. This version is overridden in full source-build. -->
<UsagePattern IdentityGlob="System.Security.Principal.Windows/8.0.0" />


<!-- Caused by multi-targeting source build for repo builds/CI. Product source build only targets NetCurrent. -->
<UsagePattern IdentityGlob="Microsoft.Diagnostics.NETCore.Client/0.2.*" />
<UsagePattern IdentityGlob="Microsoft.AspNetCore.App.Ref/8.0.*" />
<UsagePattern IdentityGlob="Microsoft.NetCore.App.Ref/8.0.*" />
<UsagePattern IdentityGlob="Microsoft.NETCore.App.Host.linux-x64/8.0.*" />
Expand Down
2 changes: 1 addition & 1 deletion eng/Version.Details.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
</Dependency>
<!-- Necessary for source-build. This allows the live version of the package to be used by source-build. -->
<Dependency Name="System.ComponentModel.Composition" Version="4.5.0">
<Uri>https://github.com/dotnet/corefx</Uri>
<Uri>https://github.com/dotnet/runtime</Uri>
<Sha>30ab651fcb4354552bd4891619a0bdd81e0ebdbf</Sha>
</Dependency>
<!-- Necessary for source-build. This allows the live version of the package to be used by source-build. -->
Expand Down
37 changes: 22 additions & 15 deletions eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -29,39 +29,47 @@
Because you will need to update Microsoft.TestPlatform.Build.UnitTests to build using that concrete .NET TFM, e.g. net8.0 for 17.8.3.
Otherwise it will restore the netstandard2.0 *reference* library into test project bin, and the test project will fail
with File not found error.
Could not load file or assembly 'Microsoft.Build.Utilities.Core...
-->
<!--
Lot of these versions are not the latest present on nuget.org, we need to use versions that are present in SourceBuild to
avoid introducing pre-builts. https://github.com/dotnet/source-build-reference-packages/tree/main/src/referencePackages/src
-->
<MicrosoftBuildFrameworkPackageVersion>17.8.3</MicrosoftBuildFrameworkPackageVersion>
<MicrosoftBuildPackageVersion>$(MicrosoftBuildFrameworkPackageVersion)</MicrosoftBuildPackageVersion>
<MicrosoftBuildUtilitiesCorePackageVersion>$(MicrosoftBuildFrameworkPackageVersion)</MicrosoftBuildUtilitiesCorePackageVersion>
<MicrosoftBuildFrameworkReferenceOnly>$(MicrosoftBuildFrameworkPackageVersion)</MicrosoftBuildFrameworkReferenceOnly>
<MicrosoftBuildReferenceOnly>$(MicrosoftBuildFrameworkPackageVersion)</MicrosoftBuildReferenceOnly>
<MicrosoftBuildUtilitiesCoreReferenceOnly>$(MicrosoftBuildFrameworkPackageVersion)</MicrosoftBuildUtilitiesCoreReferenceOnly>
<MicrosoftCodeAnalysisVersion>3.11.0</MicrosoftCodeAnalysisVersion>
<MicrosoftCodeAnalysisBannedApiAnalyzersVersion>3.11.0-beta1.23525.2</MicrosoftCodeAnalysisBannedApiAnalyzersVersion>
<MicrosoftCodeAnalysisPublicApiAnalyzersVersion>3.11.0-beta1.23525.2</MicrosoftCodeAnalysisPublicApiAnalyzersVersion>
<MicrosoftCodeAnalysisVersion>4.11.0</MicrosoftCodeAnalysisVersion>
<MicrosoftCodeAnalysisBannedApiAnalyzersVersion>3.3.4</MicrosoftCodeAnalysisBannedApiAnalyzersVersion>
<MicrosoftCodeAnalysisPublicApiAnalyzersVersion>3.3.4</MicrosoftCodeAnalysisPublicApiAnalyzersVersion>
<MicrosoftCodeCoverageIOVersion>17.7.0</MicrosoftCodeCoverageIOVersion>
<MicrosoftDiagnosticsNETCoreClientVersion>0.2.606601</MicrosoftDiagnosticsNETCoreClientVersion>
<MicrosoftExtensionsDependencyModelPackageVersion>3.1.0</MicrosoftExtensionsDependencyModelPackageVersion>
<MicrosoftExtensionsFileSystemGlobbingVersion>2.0.0</MicrosoftExtensionsFileSystemGlobbingVersion>
<MicrosoftFakesVersion>17.9.0-beta.24058.4</MicrosoftFakesVersion>
<MicrosoftExtensionsDependencyModelPackageVersion>6.0.0</MicrosoftExtensionsDependencyModelPackageVersion>
<MicrosoftExtensionsFileSystemGlobbingVersion>6.0.0</MicrosoftExtensionsFileSystemGlobbingVersion>
<MicrosoftFakesVersion>17.12.0</MicrosoftFakesVersion>
<MicrosoftInternalCodeCoverageVersion>17.14.0-preview.25067.3</MicrosoftInternalCodeCoverageVersion>
<MicrosoftVisualStudioDiagnosticsUtilitiesVersion>17.13.35716.53</MicrosoftVisualStudioDiagnosticsUtilitiesVersion>
<MicrosoftVisualStudioEnterpriseAspNetHelper>$(MicrosoftVisualStudioDiagnosticsUtilitiesVersion)</MicrosoftVisualStudioEnterpriseAspNetHelper>
<MicrosoftVisualStudioInteropVersion>17.10.525-preview.1</MicrosoftVisualStudioInteropVersion>
<MicrosoftVSTelemetryVersion>17.6.46</MicrosoftVSTelemetryVersion>
<MicrosoftVSUtilitiesInternalVersion>16.3.42</MicrosoftVSUtilitiesInternalVersion>
<MicrosoftVisualStudioInteropVersion>17.12.40418</MicrosoftVisualStudioInteropVersion>
<MicrosoftVSTelemetryVersion>17.13.24</MicrosoftVSTelemetryVersion>
<MicrosoftVSUtilitiesInternalVersion>16.3.90</MicrosoftVSUtilitiesInternalVersion>
<MicrosoftVSSDKBuildToolsVersion>17.4.2124</MicrosoftVSSDKBuildToolsVersion>
<MicrosoftWin32RegistryVersion>5.0.0</MicrosoftWin32RegistryVersion>
<NewtonsoftJsonVersion>13.0.3</NewtonsoftJsonVersion>
<NewtonsoftJsonVersion Condition="'$(DotNetBuildSourceOnly)' == 'true'">13.0.3</NewtonsoftJsonVersion>
<SystemCollectionsImmutableVersion>1.5.0</SystemCollectionsImmutableVersion>
<SystemComponentModelCompositionVersion>4.5.0</SystemComponentModelCompositionVersion>
<SystemCollectionsImmutableVersion>8.0.0</SystemCollectionsImmutableVersion>
<SystemComponentModelCompositionVersion>8.0.0</SystemComponentModelCompositionVersion>
<SystemMemoryVersion>4.5.5</SystemMemoryVersion>
<SystemNetHttpVersion>4.3.4</SystemNetHttpVersion>
<SystemReflectionMetadataVersion>1.6.0</SystemReflectionMetadataVersion>
<SystemReflectionMetadataVersion>8.0.0</SystemReflectionMetadataVersion>
<SystemUriVersion>4.3.2</SystemUriVersion>
<TestPlatformExternalsVersion>17.10.0-preview-2-34602-162</TestPlatformExternalsVersion>
<MicrosoftInternalTestPlatformExtensions>17.10.0-preview-2-34602-162</MicrosoftInternalTestPlatformExtensions>
<TestPlatformMSDiaVersion>17.9.34504.149</TestPlatformMSDiaVersion>
<TestPlatformMSDiaVersion>17.12.35519.223</TestPlatformMSDiaVersion>
<SystemSecurityPrincipalWindowsVersion>5.0.0</SystemSecurityPrincipalWindowsVersion>
<SystemRuntimeCompilerServicesUnsafeVersion>6.1.0</SystemRuntimeCompilerServicesUnsafeVersion>
</PropertyGroup>
<PropertyGroup Label="VSTest test settings">
<!-- Name of the elements must be in sync with test\Microsoft.TestPlatform.TestUtilities\IntegrationTestBase.cs -->
Expand All @@ -74,7 +82,6 @@
<MSTestTestFrameworkVersion>3.4.3</MSTestTestFrameworkVersion>
<MSTestTestAdapterVersion>3.4.3</MSTestTestAdapterVersion>
<MSTestAssertExtensionVersion>1.0.3-preview</MSTestAssertExtensionVersion>
<!-- This is the newest version of XUnit that still supports netcoreapp3.1 that we also use to run tests -->
<XUnitFrameworkVersion>2.4.2</XUnitFrameworkVersion>
<XUnitAdapterVersion>2.4.5</XUnitAdapterVersion>
<XUnitConsoleRunnerVersion>2.4.2</XUnitConsoleRunnerVersion>
Expand Down
10 changes: 5 additions & 5 deletions eng/verify-nupkgs.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ function Verify-Nuget-Packages {
$expectedNumOfFiles = @{
"Microsoft.CodeCoverage" = 59;
"Microsoft.NET.Test.Sdk" = 15;
"Microsoft.TestPlatform" = 609;
"Microsoft.TestPlatform" = 619;
"Microsoft.TestPlatform.Build" = 20;
"Microsoft.TestPlatform.CLI" = 471;
"Microsoft.TestPlatform.CLI" = 481;
"Microsoft.TestPlatform.Extensions.TrxLogger" = 34;
"Microsoft.TestPlatform.ObjectModel" = 92;
"Microsoft.TestPlatform.AdapterUtilities" = 75;
"Microsoft.TestPlatform.Portable" = 592;
"Microsoft.TestPlatform.AdapterUtilities" = 61;
"Microsoft.TestPlatform.Portable" = 608;
"Microsoft.TestPlatform.TestHost" = 62;
"Microsoft.TestPlatform.TranslationLayer" = 122;
"Microsoft.TestPlatform.Internal.Uwp" = 38;
Expand Down Expand Up @@ -63,7 +63,7 @@ function Verify-Nuget-Packages {


Write-Host "Found $(@($nugetPackages).Count) nuget packages:`n $($nugetPackages.FullName -join "`n ")"
Write-Host "Unzipping NuGet packages."
Write-Host "Unzipping NuGet packages to '$tmpDirectory'."
$unzipNugetPackageDirs = @()
foreach ($nugetPackage in $nugetPackages) {
$unzipNugetPackageDir = Join-Path $tmpDirectory $nugetPackage.BaseName
Expand Down
4 changes: 2 additions & 2 deletions playground/MSTest1/MSTest1.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>$(TargetFrameworks);net472;net5.0;net6.0;net7.0</TargetFrameworks>
<TargetFrameworks>$(TargetFrameworks);net48;net9.0;net8.0</TargetFrameworks>
<Prefer32Bit>false</Prefer32Bit>
<IsPackable>false</IsPackable>
</PropertyGroup>
Expand All @@ -11,7 +11,7 @@
<PackageReference Include="MSTest.TestFramework" Version="3.3.1" />
<PackageReference Include="coverlet.collector" Version="1.2.0" />
</ItemGroup>
<ItemGroup Condition=" $(TargetFramework.StartsWith('net4')) AND '$(OS)' != 'Windows_NT' ">
<ItemGroup Condition=" $([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', '$(NetFrameworkMinimum)')) AND '$(OS)' != 'Windows_NT' ">
<Reference Include="System" />
<Reference Include="System.Runtime" />
<Reference Include="System.Xml" />
Expand Down
4 changes: 2 additions & 2 deletions playground/MSTest2/MSTest2.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>$(TargetFrameworks);net472;net5.0;net6.0;net7.0</TargetFrameworks>
<TargetFrameworks>$(TargetFrameworks);net48;net9.0;net8.0</TargetFrameworks>
<Prefer32Bit>false</Prefer32Bit>
<IsPackable>false</IsPackable>
</PropertyGroup>
Expand All @@ -11,7 +11,7 @@
<PackageReference Include="MSTest.TestFramework" Version="3.3.1" />
<PackageReference Include="coverlet.collector" Version="1.2.0" />
</ItemGroup>
<ItemGroup Condition=" $(TargetFramework.StartsWith('net4')) AND '$(OS)' != 'Windows_NT' ">
<ItemGroup Condition=" $([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', '$(NetFrameworkMinimum)')) AND '$(OS)' != 'Windows_NT' ">
<Reference Include="System" />
<Reference Include="System.Runtime" />
<Reference Include="System.Xml" />
Expand Down
Loading

0 comments on commit f70bb54

Please sign in to comment.