diff --git a/.vsts-ci.yml b/.vsts-ci.yml index cc3714d7..55511b0b 100644 --- a/.vsts-ci.yml +++ b/.vsts-ci.yml @@ -150,6 +150,8 @@ extends: --prepareMachine -p:RID=$(_RID) -p:DotNetSignType=$(_SignType) -p:TeamName=$(TeamName) -p:OfficialBuildId=$(Build.BuildNumber) displayName: Build + env: + SYSTEM_ACCESSTOKEN: $(System.AccessToken) - script: | codesign -dv --verbose=4 artifacts/layout/dotnet-core-uninstall/dotnet-core-uninstall name: VerifySignature diff --git a/src/dotnet-core-uninstall/Shared/VSVersioning/VisualStudioSafeVersionsExtractor.cs b/src/dotnet-core-uninstall/Shared/VSVersioning/VisualStudioSafeVersionsExtractor.cs index c964c0c2..fd1c058e 100644 --- a/src/dotnet-core-uninstall/Shared/VSVersioning/VisualStudioSafeVersionsExtractor.cs +++ b/src/dotnet-core-uninstall/Shared/VSVersioning/VisualStudioSafeVersionsExtractor.cs @@ -13,7 +13,7 @@ namespace Microsoft.DotNet.Tools.Uninstall.Shared.VSVersioning internal static class VisualStudioSafeVersionsExtractor { // The tool should not be used to uninstall any more recent versions of the sdk - public static readonly SemanticVersion UpperLimit = new SemanticVersion(10, 0, 0); + public static readonly SemanticVersion UpperLimit = new SemanticVersion(11, 0, 0); // Must keep one of each of these divisions to ensure Visual Studio works. // Pairs are [inclusive, exclusive) @@ -30,7 +30,8 @@ internal static class VisualStudioSafeVersionsExtractor { (new SemanticVersion(6, 0, 100), new SemanticVersion(6, 0, 500)), string.Format(LocalizableStrings.WindowsRequirementExplanationString, " 2022") }, { (new SemanticVersion(7, 0, 100), new SemanticVersion(7, 0, 500)), string.Format(LocalizableStrings.WindowsRequirementExplanationString, " 2022") }, { (new SemanticVersion(8, 0, 100), new SemanticVersion(8, 0, 500)), string.Format(LocalizableStrings.WindowsRequirementExplanationString, " 2022") }, - { (new SemanticVersion(9, 0, 100), UpperLimit), string.Format(LocalizableStrings.WindowsRequirementExplanationString, "") } + { (new SemanticVersion(9, 0, 100), new SemanticVersion(9, 0, 400)), string.Format(LocalizableStrings.WindowsRequirementExplanationString, " 2022") }, + { (new SemanticVersion(10, 0, 100), UpperLimit), string.Format(LocalizableStrings.WindowsRequirementExplanationString, " 2026") } }; private static (IDictionary, string>, IEnumerable) ApplyWindowsVersionDivisions(IEnumerable bundleList) diff --git a/test/dotnet-core-uninstall.Tests/Shared/Commands/CommandBundleFilterTests.cs b/test/dotnet-core-uninstall.Tests/Shared/Commands/CommandBundleFilterTests.cs index c4d5c584..d0a81cf2 100644 --- a/test/dotnet-core-uninstall.Tests/Shared/Commands/CommandBundleFilterTests.cs +++ b/test/dotnet-core-uninstall.Tests/Shared/Commands/CommandBundleFilterTests.cs @@ -21,7 +21,7 @@ namespace Microsoft.DotNet.Tools.Uninstall.Tests.Shared.Commands { public class CommandBundleFilterTests { - private static readonly string[] versions = { "1.0.0", "1.0.1", "1.1.0", "2.1.0", "2.1.500", "2.1.600", "2.2.100", "2.2.200", "5.0.100", "6.0.100", "7.0.100", "8.0.100", "9.0.100", "10.0.100", "11.11.11" }; + private static readonly string[] versions = { "1.0.0", "1.0.1", "1.1.0", "2.1.0", "2.1.500", "2.1.600", "2.2.100", "2.2.200", "5.0.100", "6.0.100", "7.0.100", "8.0.100", "9.0.100", "10.0.100", "11.0.100", "12.12.12" }; private Dictionary versionsWithArch = new Dictionary { { "3.0.0", BundleArch.X64 }, @@ -132,10 +132,10 @@ internal void TestRequiredUninstallableWhenExplicitlyAdded(IEnumerable b } [Theory] - [InlineData("remove {0} 10.0.100")] - [InlineData("remove {0} 11.11.11")] + [InlineData("remove {0} 11.0.100")] + [InlineData("remove {0} 12.12.12")] [InlineData("remove {0} --all --force")] - [InlineData("remove {0} 1.0.0 1.0.1 1.1.0 2.1.0 2.1.500 2.1.600 2.2.100 2.2.200 5.0.100 7.0.100 11.11.11")] + [InlineData("remove {0} 1.0.0 1.0.1 1.1.0 2.1.0 2.1.500 2.1.600 2.2.100 2.2.200 5.0.100 7.0.100 11.0.100 12.12.12")] internal void TestUpperLimitAlwaysRequired(string command) { var sdkBundles = new List>(); diff --git a/test/dotnet-core-uninstall.Tests/Shared/VSVersioning/VSVersionTests.cs b/test/dotnet-core-uninstall.Tests/Shared/VSVersioning/VSVersionTests.cs index 8c36e183..f7453e1b 100644 --- a/test/dotnet-core-uninstall.Tests/Shared/VSVersioning/VSVersionTests.cs +++ b/test/dotnet-core-uninstall.Tests/Shared/VSVersioning/VSVersionTests.cs @@ -31,7 +31,9 @@ public class VSVersionTests [InlineData(new string[] { "6.0.100", "6.0.101", "7.0.100" }, new bool[] { true, false, false })] [InlineData(new string[] { "7.0.100", "7.0.101", "8.0.100" }, new bool[] { true, false, false })] [InlineData(new string[] { "8.0.100", "8.0.101", "9.0.100" }, new bool[] { true, false, false })] - [InlineData(new string[] { "10.0.100", "10.0.101", "11.100.100" }, new bool[] { false, false, false })] + [InlineData(new string[] { "9.0.100", "9.0.101", "10.0.100" }, new bool[] { true, false, false })] + [InlineData(new string[] { "10.0.100", "10.0.101", "11.0.100" }, new bool[] { true, false, false })] + [InlineData(new string[] { "11.0.100", "11.0.101", "12.0.100" }, new bool[] { false, false, false })] internal void TestGetUninstallableWindows(string[] versions, bool[] allowed) { var bundles = new List(); @@ -54,7 +56,7 @@ internal void TestGetUninstallableWindows(string[] versions, bool[] allowed) [InlineData(new string[] { "2.1.0", "1.0.1" }, new bool[] { false, true }, new string[] { "1.0.0", "1.1.0" }, new bool[] { false, false })] [InlineData(new string[] { "3.0.0", "7.0.100" }, new bool[] { true, false }, new string[] { "1.0.0", "1.1.0", "1.0.1", "1.0.2", "1.1.3" }, new bool[] { true, true, true, false, false })] [InlineData(new string[] { "3.0.0", "5.0.100" }, new bool[] { true, false }, new string[] { "1.0.0", "1.1.0", "1.0.1", "5.0.100" }, new bool[] { true, false, false, false })] - [InlineData(new string[] { "5.0.100", "5.0.101", "11.100.100" }, new bool[] { true, false, false }, new string[] { "5.0.100", "11.0.0" }, new bool[] { false, false })] + [InlineData(new string[] { "5.0.100", "5.0.101", "11.0.100" }, new bool[] { true, false, false }, new string[] { "5.0.100", "11.0.0" }, new bool[] { false, false })] [InlineData(new string[] { "5.0.100", "6.0.100", "6.0.101" }, new bool[] { true, true, false }, new string[] { "5.0.100" }, new bool[] { false })] internal void TestGetUninstallableMac(string[] sdkVersions, bool[] sdkAllowed, string[] runtimeVersions, bool[] runtimeAllowed) { @@ -80,10 +82,11 @@ internal void TestGetUninstallableMac(string[] sdkVersions, bool[] sdkAllowed, s [InlineData(new string[] { "1.0.0", "1.0.1", "1.0.2" }, new bool[] { true, true, false })] [InlineData(new string[] { "2.1.500", "2.1.400", "2.1.600" }, new bool[] { false, true, false })] [InlineData(new string[] { "2.2.100", "2.2.200", "2.2.300" }, new bool[] { false, true, false })] - [InlineData(new string[] { "5.0.100", "5.0.101", "10.0.1" }, new bool[] { true, false, false })] + [InlineData(new string[] { "5.0.100", "5.0.101", "10.0.1" }, new bool[] { true, false, true })] [InlineData(new string[] { "6.0.100", "7.0.100", "7.0.101" }, new bool[] { false, true, false })] [InlineData(new string[] { "9.0.100", "9.0.101", "10.100.100" }, new bool[] { true, false, false })] - [InlineData(new string[] { "10.0.100", "10.0.101", "11.100.100" }, new bool[] { false, false, false })] + [InlineData(new string[] { "10.0.100", "10.0.101", "11.0.100" }, new bool[] { true, false, false })] + [InlineData(new string[] { "11.0.100", "11.0.101", "12.0.100" }, new bool[] { false, false, false })] internal void TestGetUninstallableNonSdkVersionsWindows(string[] versions, bool[] allowed) { var bundles = new List(); @@ -168,7 +171,7 @@ private void CheckAllowed(IEnumerable allBundles, IEnumerable un // Check others are uninstallable unless their version is above the upper limit foreach (Bundle bundle in otherBundles) { - if (bundle.Version.SemVer > VisualStudioSafeVersionsExtractor.UpperLimit) + if (bundle.Version.SemVer >= VisualStudioSafeVersionsExtractor.UpperLimit) { uninstallableBundles.Should().NotContain(bundle); } @@ -184,7 +187,7 @@ private void CheckAllowed(IEnumerable allBundles, IEnumerable un [InlineData(new string[] { "1.0.1", "1.0.0" }, new string[] { "", "None" })] [InlineData(new string[] { "2.3.0", "2.1.800", "2.1.300" }, new string[] { "None", " 2019", " 2017" })] [InlineData(new string[] { "2.1.500", "2.1.400", "2.1.600" }, new string[] { " 2017", "None", " 2019" })] - [InlineData(new string[] { "2.1.500", "10.0.1", "10.0.0" }, new string[] { " 2017", "UpperLimit", "UpperLimit" })] + [InlineData(new string[] { "2.1.500", "10.0.1", "10.0.0" }, new string[] { " 2017", "None", "None" })] internal void TestGetListCommandUninstallableStringsWindows(string[] versions, string[] expectedStrings) { expectedStrings = expectedStrings.Select(s => s.Equals("UpperLimit") ? VisualStudioSafeVersionsExtractor.UpperLimit.ToNormalizedString() : s).ToArray(); @@ -206,8 +209,8 @@ internal void TestGetListCommandUninstallableStringsWindows(string[] versions, s [InlineData(new string[] { "1.0.0", "1.0.1" }, new string[] { "None", "SDK" }, new string[] { "1.0.0", "1.0.1" }, new string[] { "None", "Runtime" })] [InlineData(new string[] { "2.1.0", "1.0.1" }, new string[] { "SDK", "None" }, new string[] { "2.0.0", "1.1.0" }, new string[] { "Runtime", "Runtime" })] [InlineData(new string[] { "3.0.100", "5.0.100" }, new string[] { "None", "SDK" }, new string[] { "1.0.0", "1.1.0", "1.0.1", "1.0.2", "1.1.3" }, new string[] { "None", "None", "None", "Runtime", "Runtime" })] - [InlineData(new string[] { "3.0.100", "5.0.100" }, new string[] { "None", "SDK" }, new string[] { "1.0.0", "1.1.0", "1.0.1", "10.0.100" }, new string[] { "None", "Runtime", "Runtime", "UpperLimit" })] - [InlineData(new string[] { "5.0.100", "5.0.101", "11.100.100" }, new string[] { "None", "SDK", "UpperLimit" }, new string[] { "5.0.100", "11.0.0" }, new string[] { "Runtime", "UpperLimit" })] + [InlineData(new string[] { "3.0.100", "5.0.100" }, new string[] { "None", "SDK" }, new string[] { "1.0.0", "1.1.0", "1.0.1", "10.0.100" }, new string[] { "None", "Runtime", "Runtime", "Runtime" })] + [InlineData(new string[] { "5.0.100", "5.0.101", "11.0.100" }, new string[] { "None", "SDK", "UpperLimit" }, new string[] { "5.0.100", "11.0.0" }, new string[] { "Runtime", "UpperLimit" })] internal void StringsMac(string[] sdkVersions, string[] sdkExpected, string[] runtimeVersions, string[] runtimeExpected) {