Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .vsts-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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<IEnumerable<Bundle>, string>, IEnumerable<Bundle>) ApplyWindowsVersionDivisions(IEnumerable<Bundle> bundleList)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<string, BundleArch> versionsWithArch = new Dictionary<string, BundleArch>
{
{ "3.0.0", BundleArch.X64 },
Expand Down Expand Up @@ -132,10 +132,10 @@ internal void TestRequiredUninstallableWhenExplicitlyAdded(IEnumerable<Bundle> 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<Bundle<SdkVersion>>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<Bundle>();
Expand All @@ -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)
{
Expand All @@ -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<Bundle>();
Expand Down Expand Up @@ -168,7 +171,7 @@ private void CheckAllowed(IEnumerable<Bundle> allBundles, IEnumerable<Bundle> 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);
}
Expand All @@ -184,7 +187,7 @@ private void CheckAllowed(IEnumerable<Bundle> allBundles, IEnumerable<Bundle> 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();
Expand All @@ -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)
{
Expand Down