diff --git a/src/installer/tests/HostActivation.Tests/FrameworkResolution/MultipleHives.cs b/src/installer/tests/HostActivation.Tests/FrameworkResolution/MultipleHives.cs index cf2af06577adf5..16ad7c34f793c4 100644 --- a/src/installer/tests/HostActivation.Tests/FrameworkResolution/MultipleHives.cs +++ b/src/installer/tests/HostActivation.Tests/FrameworkResolution/MultipleHives.cs @@ -61,7 +61,7 @@ public void FrameworkHiveSelection_CurrentDirectoryIsIgnored() { RunTest(new TestSettings() .WithRuntimeConfigCustomizer(runtimeConfig => runtimeConfig - .WithTfm(Constants.Tfm.Net6) + .WithTfm("net6.0") .WithFramework(MicrosoftNETCoreApp, "5.0.0")) .WithWorkingDirectory(SharedState.DotNetCurrentHive.BinPath), multiLevelLookup: true) diff --git a/src/installer/tests/TestUtils/Constants.cs b/src/installer/tests/TestUtils/Constants.cs index bba6b13a305167..90fddc16bef399 100644 --- a/src/installer/tests/TestUtils/Constants.cs +++ b/src/installer/tests/TestUtils/Constants.cs @@ -33,14 +33,6 @@ public static class RollForwardSetting public const string Disable = "Disable"; } - public static class Tfm - { - public const string RuntimeConfigPropertyName = "tfm"; - public const string Net6 = "net6.0"; - public const string Net7 = "net7.0"; - public const string Net8 = "net8.0"; - } - public static class FxVersion { public const string CommandLineArgument = "--fx-version"; diff --git a/src/installer/tests/TestUtils/RuntimeConfig.cs b/src/installer/tests/TestUtils/RuntimeConfig.cs index 057346a31922ec..269918a963f098 100644 --- a/src/installer/tests/TestUtils/RuntimeConfig.cs +++ b/src/installer/tests/TestUtils/RuntimeConfig.cs @@ -279,9 +279,7 @@ public void Save() if (_tfm is not null) { - runtimeOptions.Add( - Constants.Tfm.RuntimeConfigPropertyName, - _tfm); + runtimeOptions.Add("tfm", _tfm); } if (_properties.Count > 0) diff --git a/src/libraries/Microsoft.Extensions.Hosting/tests/FunctionalTests/IntegrationTesting/src/Common/Tfm.cs b/src/libraries/Microsoft.Extensions.Hosting/tests/FunctionalTests/IntegrationTesting/src/Common/Tfm.cs deleted file mode 100644 index a4ae0c12f9236c..00000000000000 --- a/src/libraries/Microsoft.Extensions.Hosting/tests/FunctionalTests/IntegrationTesting/src/Common/Tfm.cs +++ /dev/null @@ -1,23 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -using System; - -namespace Microsoft.Extensions.Hosting.IntegrationTesting -{ - public static class Tfm - { - public const string Net462 = "net462"; - public const string NetCoreApp20 = "netcoreapp2.0"; - public const string NetCoreApp21 = "netcoreapp2.1"; - public const string NetCoreApp22 = "netcoreapp2.2"; - public const string NetCoreApp30 = "netcoreapp3.0"; - public const string NetCoreApp31 = "netcoreapp3.1"; - public const string NetCoreApp50 = "net5.0"; - - public static bool Matches(string tfm1, string tfm2) - { - return string.Equals(tfm1, tfm2, StringComparison.OrdinalIgnoreCase); - } - } -} diff --git a/src/libraries/Microsoft.Extensions.Hosting/tests/FunctionalTests/IntegrationTesting/src/Deployers/ApplicationDeployer.cs b/src/libraries/Microsoft.Extensions.Hosting/tests/FunctionalTests/IntegrationTesting/src/Deployers/ApplicationDeployer.cs index 37540702fcb75f..34c5832beedabb 100644 --- a/src/libraries/Microsoft.Extensions.Hosting/tests/FunctionalTests/IntegrationTesting/src/Deployers/ApplicationDeployer.cs +++ b/src/libraries/Microsoft.Extensions.Hosting/tests/FunctionalTests/IntegrationTesting/src/Deployers/ApplicationDeployer.cs @@ -61,7 +61,7 @@ private void ValidateParameters() private RuntimeFlavor GetRuntimeFlavor(string tfm) { - if (Tfm.Matches(Tfm.Net462, tfm)) + if (tfm.ToLowerInvariant() == "net462") { return RuntimeFlavor.Clr; } diff --git a/src/libraries/Microsoft.Extensions.Hosting/tests/FunctionalTests/IntegrationTesting/src/Deployers/SelfHostDeployer.cs b/src/libraries/Microsoft.Extensions.Hosting/tests/FunctionalTests/IntegrationTesting/src/Deployers/SelfHostDeployer.cs index 79e87c59ee9801..0ef58a0d95924d 100644 --- a/src/libraries/Microsoft.Extensions.Hosting/tests/FunctionalTests/IntegrationTesting/src/Deployers/SelfHostDeployer.cs +++ b/src/libraries/Microsoft.Extensions.Hosting/tests/FunctionalTests/IntegrationTesting/src/Deployers/SelfHostDeployer.cs @@ -83,8 +83,9 @@ protected async Task StartSelfHostAsync() { // Core+Standalone always publishes. This must be Clr+Standalone or Core+Portable. // Run from the pre-built bin/{config}/{tfm} directory. + Version version = Environment.Version; var targetFramework = DeploymentParameters.TargetFramework - ?? (DeploymentParameters.RuntimeFlavor == RuntimeFlavor.Clr ? Tfm.Net462 : Tfm.NetCoreApp22); + ?? (DeploymentParameters.RuntimeFlavor == RuntimeFlavor.Clr ? "net462" : $"net{version.Major}.{version.Minor}"); workingDirectory = Path.Combine(DeploymentParameters.ApplicationPath, "bin", DeploymentParameters.Configuration, targetFramework); // CurrentDirectory will point to bin/{config}/{tfm}, but the config and static files aren't copied, point to the app base instead. DeploymentParameters.EnvironmentVariables["DOTNET_CONTENTROOT"] = DeploymentParameters.ApplicationPath; diff --git a/src/libraries/Microsoft.Extensions.Hosting/tests/FunctionalTests/ShutdownTests.cs b/src/libraries/Microsoft.Extensions.Hosting/tests/FunctionalTests/ShutdownTests.cs index d04ed442a9444f..4625de304dd3ea 100644 --- a/src/libraries/Microsoft.Extensions.Hosting/tests/FunctionalTests/ShutdownTests.cs +++ b/src/libraries/Microsoft.Extensions.Hosting/tests/FunctionalTests/ShutdownTests.cs @@ -58,12 +58,13 @@ private async Task ExecuteShutdownTest(string testName, string shutdownMechanic) var applicationPath = string.Empty; // disabled for now #pragma warning restore 0618 + Version version = Environment.Version; var deploymentParameters = new DeploymentParameters( applicationPath, RuntimeFlavor.CoreClr, RuntimeArchitecture.x64) { - TargetFramework = Tfm.NetCoreApp50, + TargetFramework = $"Environment{version.Major}.{version.Minor}", ApplicationType = ApplicationType.Portable, PublishApplicationBeforeDeployment = true, StatusMessagesEnabled = false