diff --git a/src/Installer/Microsoft.Dotnet.Installation/Internal/ChannelVersionResolver.cs b/src/Installer/Microsoft.Dotnet.Installation/Internal/ChannelVersionResolver.cs index a8b08bc4ba4f..6ae34e30e08f 100644 --- a/src/Installer/Microsoft.Dotnet.Installation/Internal/ChannelVersionResolver.cs +++ b/src/Installer/Microsoft.Dotnet.Installation/Internal/ChannelVersionResolver.cs @@ -23,15 +23,10 @@ internal class ChannelVersionResolver /// public const string LtsChannel = "lts"; - /// - /// Channel keyword for the latest Standard Term Support (STS) release. - /// - public const string StsChannel = "sts"; - /// /// Known channel keywords that are always valid. /// - public static readonly IReadOnlyList KnownChannelKeywords = [LatestChannel, PreviewChannel, LtsChannel, StsChannel]; + public static readonly IReadOnlyList KnownChannelKeywords = [LatestChannel, PreviewChannel, LtsChannel]; /// /// Maximum reasonable major version number. .NET versions are currently single-digit; @@ -204,16 +199,15 @@ private static (int Major, int Minor, string? FeatureBand, bool IsFullySpecified /// /// Finds the latest fully specified version for a given channel string (major, major.minor, or feature band). /// - /// Channel string (e.g., "9", "9.0", "9.0.1xx", "9.0.103", "lts", "sts", "preview") + /// Channel string (e.g., "9", "9.0", "9.0.1xx", "9.0.103", "lts", "preview") /// The component to check (ie SDK or runtime) /// Latest fully specified version string, or null if not found public ReleaseVersion? GetLatestVersionForChannel(UpdateChannel channel, InstallComponent component) { - if (string.Equals(channel.Name, LtsChannel, StringComparison.OrdinalIgnoreCase) || string.Equals(channel.Name, StsChannel, StringComparison.OrdinalIgnoreCase)) + if (string.Equals(channel.Name, LtsChannel, StringComparison.OrdinalIgnoreCase)) { - var releaseType = string.Equals(channel.Name, LtsChannel, StringComparison.OrdinalIgnoreCase) ? ReleaseType.LTS : ReleaseType.STS; var productIndex = _releaseManifest.GetReleasesIndex(); - return GetLatestVersionByReleaseType(productIndex, releaseType, component); + return GetLatestVersionByReleaseType(productIndex, ReleaseType.LTS, component); } else if (string.Equals(channel.Name, PreviewChannel, StringComparison.OrdinalIgnoreCase)) { diff --git a/src/Installer/Microsoft.Dotnet.Installation/Internal/UpdateChannel.cs b/src/Installer/Microsoft.Dotnet.Installation/Internal/UpdateChannel.cs index 32cbea98acd3..66646829c648 100644 --- a/src/Installer/Microsoft.Dotnet.Installation/Internal/UpdateChannel.cs +++ b/src/Installer/Microsoft.Dotnet.Installation/Internal/UpdateChannel.cs @@ -59,7 +59,7 @@ public bool IsSdkVersionOrFeatureBand() /// /// Checks if the given version matches this channel pattern. - /// Supports exact versions, named channels (latest, lts, sts, preview), + /// Supports exact versions, named channels (latest, lts, preview), /// major-only, major.minor, and feature band patterns. /// public bool Matches(ReleaseVersion version) @@ -84,11 +84,7 @@ public bool Matches(ReleaseVersion version) // These channels match any version. The "preview" channel may resolve to a stable version // when no preview exists yet (e.g., after a major release before the next preview). - // The "sts" channel includes both STS and LTS releases, since users on this channel want - // newer versions quickly regardless of support lifecycle. GC still keeps only the latest - // version per channel, so broad matching here doesn't prevent cleanup. if (Name.Equals("latest", StringComparison.OrdinalIgnoreCase) || - Name.Equals("sts", StringComparison.OrdinalIgnoreCase) || Name.Equals("preview", StringComparison.OrdinalIgnoreCase)) { return true; diff --git a/test/dotnetup.Tests/ChannelVersionResolverTests.cs b/test/dotnetup.Tests/ChannelVersionResolverTests.cs index d86f59ad753b..c97700dc21a5 100644 --- a/test/dotnetup.Tests/ChannelVersionResolverTests.cs +++ b/test/dotnetup.Tests/ChannelVersionResolverTests.cs @@ -61,21 +61,13 @@ public void GetLatestVersionForChannel_LTS_ReturnsLatestLTSVersion() } [Fact] - public void GetLatestVersionForChannel_STS_ReturnsLatestSTSVersion() + public void GetLatestVersionForChannel_STS_IsNoLongerSupported() { var manifest = new ChannelVersionResolver(); - var version = manifest.GetLatestVersionForChannel(new UpdateChannel("sts"), InstallComponent.SDK); - - Log.WriteLine($"STS Version found: {version}"); - - // Check that we got a version - Assert.NotNull(version); - - // STS versions should have odd major versions (e.g., 7.0, 9.0, 11.0) - Assert.True(version.Major % 2 != 0, $"STS version {version} should have an odd major version"); - // Should not be a preview version - Assert.Null(version.Prerelease); + // "sts" channel has been removed - it should not resolve to a version + var version = manifest.GetLatestVersionForChannel(new UpdateChannel("sts"), InstallComponent.SDK); + Assert.Null(version); } [Fact(Skip = "No preview releases may be available after GA of a major release and before preview 1 of the next")] @@ -106,7 +98,6 @@ public void GetLatestVersionForChannel_Preview_ReturnsLatestPreviewVersion() [InlineData("latest", true)] [InlineData("preview", true)] [InlineData("lts", true)] - [InlineData("sts", true)] [InlineData("LTS", true)] // Case insensitive [InlineData("9", true)] [InlineData("9.0", true)] @@ -146,9 +137,11 @@ public void GetSupportedChannels_WithFeatureBands_IncludesFeatureBandChannels() // Should include named channels Assert.Contains("latest", channels); Assert.Contains("lts", channels); - Assert.Contains("sts", channels); Assert.Contains("preview", channels); + // "sts" channel has been removed + Assert.DoesNotContain("sts", channels); + // Should include product versions like "10.0" Assert.Contains(channels, c => c.EndsWith(".0") && !c.Contains("xx")); @@ -165,9 +158,11 @@ public void GetSupportedChannels_WithoutFeatureBands_ExcludesFeatureBandChannels // Should include named channels Assert.Contains("latest", channels); Assert.Contains("lts", channels); - Assert.Contains("sts", channels); Assert.Contains("preview", channels); + // "sts" channel has been removed + Assert.DoesNotContain("sts", channels); + // Should include product versions like "10.0" Assert.Contains(channels, c => c.EndsWith(".0") && !c.Contains("xx")); diff --git a/test/dotnetup.Tests/DnupE2Etest.cs b/test/dotnetup.Tests/DnupE2Etest.cs index f2ecd3b8e5ce..a1d910f36187 100644 --- a/test/dotnetup.Tests/DnupE2Etest.cs +++ b/test/dotnetup.Tests/DnupE2Etest.cs @@ -37,7 +37,6 @@ public class InstallEndToEndTests new object[] { "9.0.1xx" }, new object[] { "latest" }, new object[] { "preview" }, - new object[] { "sts" }, new object[] { "lts" }, }; diff --git a/test/dotnetup.Tests/LibraryTests.cs b/test/dotnetup.Tests/LibraryTests.cs index e4648de4c742..d117c0102b8c 100644 --- a/test/dotnetup.Tests/LibraryTests.cs +++ b/test/dotnetup.Tests/LibraryTests.cs @@ -26,7 +26,6 @@ public LibraryTests(ITestOutputHelper log) [Theory] [InlineData("9", InstallComponent.SDK)] [InlineData("latest", InstallComponent.SDK)] - [InlineData("sts", InstallComponent.SDK)] [InlineData("lts", InstallComponent.SDK)] [InlineData("preview", InstallComponent.SDK)] [InlineData("9", InstallComponent.Runtime)] @@ -58,7 +57,8 @@ public void TestGetSupportedChannels() var releaseInfoProvider = InstallerFactory.CreateReleaseInfoProvider(); var channels = releaseInfoProvider.GetSupportedChannels(); - channels.Should().Contain(new[] { "latest", "lts", "sts", "preview" }); + channels.Should().Contain(new[] { "latest", "lts", "preview" }); + channels.Should().NotContain("sts"); // This will need to be updated every few years as versions go out of support channels.Should().Contain(new[] { "10.0", "10.0.1xx" }); diff --git a/test/dotnetup.Tests/TelemetryTests.cs b/test/dotnetup.Tests/TelemetryTests.cs index 06823b25578b..ae6ae3a9276b 100644 --- a/test/dotnetup.Tests/TelemetryTests.cs +++ b/test/dotnetup.Tests/TelemetryTests.cs @@ -152,7 +152,6 @@ public class VersionSanitizerTelemetryTests [InlineData("latest", "latest")] [InlineData("preview", "preview")] [InlineData("lts", "lts")] - [InlineData("sts", "sts")] public void Sanitize_ValidVersions_PassThrough(string input, string expected) { var result = VersionSanitizer.Sanitize(input); diff --git a/test/dotnetup.Tests/Utilities/UpdateChannelExtensions.cs b/test/dotnetup.Tests/Utilities/UpdateChannelExtensions.cs index 3c35ac357b97..d7529a716c9c 100644 --- a/test/dotnetup.Tests/Utilities/UpdateChannelExtensions.cs +++ b/test/dotnetup.Tests/Utilities/UpdateChannelExtensions.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. using System; +using System.Linq; using Microsoft.Deployment.DotNet.Releases; using Microsoft.Dotnet.Installation.Internal; using Microsoft.DotNet.Tools.Bootstrapper; @@ -22,10 +23,7 @@ public static bool IsFullySpecifiedVersion(this UpdateChannel channel) var parts = channel.Name.Split('.'); // Special channels are not fully specified versions - if (string.Equals(channel.Name, "lts", StringComparison.OrdinalIgnoreCase) || - string.Equals(channel.Name, "sts", StringComparison.OrdinalIgnoreCase) || - string.Equals(channel.Name, "preview", StringComparison.OrdinalIgnoreCase) || - string.Equals(channel.Name, "latest", StringComparison.OrdinalIgnoreCase)) + if (ChannelVersionResolver.KnownChannelKeywords.Any(k => string.Equals(channel.Name, k, StringComparison.OrdinalIgnoreCase))) { return false; } diff --git a/test/dotnetup.Tests/VersionSanitizerTests.cs b/test/dotnetup.Tests/VersionSanitizerTests.cs index c09bc4e07906..78a84039dc9c 100644 --- a/test/dotnetup.Tests/VersionSanitizerTests.cs +++ b/test/dotnetup.Tests/VersionSanitizerTests.cs @@ -14,8 +14,6 @@ public class VersionSanitizerTests [InlineData("LATEST", "latest")] [InlineData("lts", "lts")] [InlineData("LTS", "lts")] - [InlineData("sts", "sts")] - [InlineData("STS", "sts")] [InlineData("preview", "preview")] [InlineData("PREVIEW", "preview")] public void Sanitize_ChannelKeywords_ReturnsLowercase(string input, string expected)