Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update for 8 --> 9 #268

Merged
merged 11 commits into from
Mar 7, 2024
20 changes: 10 additions & 10 deletions src/dotnet-core-uninstall/LocalizableStrings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions src/dotnet-core-uninstall/LocalizableStrings.resx
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ Uninstalling this item will cause Visual Studio to break.
<data name="UpperLimitRequirement" xml:space="preserve">
<value>Cannot uninstall version {0} and above</value>
</data>
<data name="WindowsRequirementExplainationString" xml:space="preserve">
<data name="WindowsRequirementExplanationString" xml:space="preserve">
<value>Used by Visual Studio{0}. Specify individually or use —-force to remove</value>
</data>
<data name="ForceOptionDescriptionWindows" xml:space="preserve">
Expand All @@ -341,21 +341,21 @@ The versions that can be uninstalled with this tool are:
<data name="UninstallNoOptionDescriptionMac" xml:space="preserve">
<value>Remove specified .NET Core SDKs or Runtimes. By default, this tool does not uninstall versions that might be needed for Visual Studio for Mac or SDKs. Read the documentation for the .NET Core Uninstall Tool at https://aka.ms/dotnet-core-uninstall-docs.</value>
</data>
<data name="MacRuntimeRequirementExplainationString" xml:space="preserve">
<data name="MacRuntimeRequirementExplanationString" xml:space="preserve">
<value>Used by Visual Studio for Mac or SDKs. Specify individually or use —-force to remove</value>
</data>
<data name="MacSDKRequirementExplainationString" xml:space="preserve">
<data name="MacSDKRequirementExplanationString" xml:space="preserve">
<value>Used by Visual Studio for Mac. Specify individually or use —-force to remove</value>
</data>
<data name="MacListCommandOutput" xml:space="preserve">
<value>
This tool cannot uninstall versions of the runtime or SDK that are installed using zip/scripts. The versions that can be uninstalled with this tool are:
</value>
</data>
<data name="HelpExplainationParagraphMac" xml:space="preserve">
<data name="HelpExplanationParagraphMac" xml:space="preserve">
<value>(*) By default, SDKs and Runtimes that have a high probability of being used by Visual Studio for Mac or SDKs are not removed. To remove these, specify them individually or use --force. If removing SDKs or Runtimes causes issues with your installation of Visual Studio for Mac, run “Repair”. SDKs and Runtimes are available for download at aka.ms/dotnet-core-download.</value>
</data>
<data name="HelpExplainationParagraphWindows" xml:space="preserve">
<data name="HelpExplanationParagraphWindows" xml:space="preserve">
<value>(*) By default, SDKs and Runtimes that have a high probability of being used by Visual Studio are not removed. To remove these, specify them individually or use --force. If removing SDKs or Runtimes causes issues with your installation of Visual Studio, run “Repair”. SDKs and Runtimes are available for download at aka.ms/dotnet-core-download.</value>
</data>
<data name="MacConfirmationPromptOutputFormat" xml:space="preserve">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ public override void Write(ICommand command)
base.Write(command);
if (command.Name.Equals("dry-run") || command.Name.Equals("remove"))
{
Console.Out.Write(RuntimeInfo.RunningOnWindows ? LocalizableStrings.HelpExplainationParagraphWindows :
LocalizableStrings.HelpExplainationParagraphMac);
Console.Out.Write(RuntimeInfo.RunningOnWindows ? LocalizableStrings.HelpExplanationParagraphWindows :
LocalizableStrings.HelpExplanationParagraphMac);
Console.Out.Write(Environment.NewLine);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,33 +13,36 @@ 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(8, 0, 0);
public static readonly SemanticVersion UpperLimit = new SemanticVersion(9, 0, 0);

// Must keep one of each of these divisions to ensure Visual Studio works.
// Pairs are [inclusive, exclusive)
private static readonly Dictionary<(SemanticVersion, SemanticVersion), string> WindowsVersionDivisionsToExplaination = new Dictionary<(SemanticVersion, SemanticVersion), string>
private static readonly Dictionary<(SemanticVersion, SemanticVersion), string> WindowsVersionDivisionsToExplanation = new Dictionary<(SemanticVersion, SemanticVersion), string>
{
{ (new SemanticVersion(1, 0, 0), new SemanticVersion(2, 0, 0)), string.Format(LocalizableStrings.WindowsRequirementExplainationString, "") },
{ (new SemanticVersion(2, 0, 0), new SemanticVersion(2, 1, 300)), string.Format(LocalizableStrings.WindowsRequirementExplainationString, "") },
{ (new SemanticVersion(2, 1, 300), new SemanticVersion(2, 1, 600)), string.Format(LocalizableStrings.WindowsRequirementExplainationString, " 2017") },
{ (new SemanticVersion(2, 1, 600), new SemanticVersion(2, 1, 900)), string.Format(LocalizableStrings.WindowsRequirementExplainationString, " 2019") },
{ (new SemanticVersion(2, 2, 100), new SemanticVersion(2, 2, 200)), string.Format(LocalizableStrings.WindowsRequirementExplainationString, " 2017") },
{ (new SemanticVersion(2, 2, 200), new SemanticVersion(2, 2, 500)), string.Format(LocalizableStrings.WindowsRequirementExplainationString, " 2019") },
{ (new SemanticVersion(3, 0, 100), new SemanticVersion(5, 0, 600)), string.Format(LocalizableStrings.WindowsRequirementExplainationString, " 2019") },
{ (new SemanticVersion(6, 0, 100), UpperLimit), string.Format(LocalizableStrings.WindowsRequirementExplainationString, "") }
{ (new SemanticVersion(1, 0, 0), new SemanticVersion(2, 0, 0)), string.Format(LocalizableStrings.WindowsRequirementExplanationString, "") },
{ (new SemanticVersion(2, 0, 0), new SemanticVersion(2, 1, 300)), string.Format(LocalizableStrings.WindowsRequirementExplanationString, "") },
{ (new SemanticVersion(2, 1, 300), new SemanticVersion(2, 1, 600)), string.Format(LocalizableStrings.WindowsRequirementExplanationString, " 2017") },
{ (new SemanticVersion(2, 1, 600), new SemanticVersion(2, 1, 900)), string.Format(LocalizableStrings.WindowsRequirementExplanationString, " 2019") },
{ (new SemanticVersion(2, 2, 100), new SemanticVersion(2, 2, 200)), string.Format(LocalizableStrings.WindowsRequirementExplanationString, " 2017") },
{ (new SemanticVersion(2, 2, 200), new SemanticVersion(2, 2, 500)), string.Format(LocalizableStrings.WindowsRequirementExplanationString, " 2019") },
{ (new SemanticVersion(3, 0, 100), new SemanticVersion(3, 1, 500)), string.Format(LocalizableStrings.WindowsRequirementExplanationString, " 2019") },
{ (new SemanticVersion(5, 0, 100), new SemanticVersion(5, 0, 600)), string.Format(LocalizableStrings.WindowsRequirementExplanationString, " 2019") },
{ (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), UpperLimit), string.Format(LocalizableStrings.WindowsRequirementExplanationString, "") }
};

private static (IDictionary<IEnumerable<Bundle>, string>, IEnumerable<Bundle>) ApplyWindowsVersionDivisions(IEnumerable<Bundle> bundleList)
{
var dividedBundles = new Dictionary<IEnumerable<Bundle>, string>();
foreach (var (division, explaination) in WindowsVersionDivisionsToExplaination)
foreach (var (division, explanation) in WindowsVersionDivisionsToExplanation)
{
var bundlesInRange = bundleList.Where(bundle => bundle.Version is SdkVersion &&
division.Item1 <= bundle.Version.GetVersionWithoutTags() && bundle.Version.GetVersionWithoutTags() < division.Item2);
bundleList = bundleList.Except(bundlesInRange);
if (bundlesInRange.Count() > 0)
{
dividedBundles.Add(bundlesInRange, explaination);
dividedBundles.Add(bundlesInRange, explanation);
}
}

Expand All @@ -54,13 +57,13 @@ private static (IDictionary<IEnumerable<Bundle>, string>, IEnumerable<Bundle>) A
var dividedBundles = bundleList
.Where(bundle => bundle.Version is RuntimeVersion)
.GroupBy(bundle => bundle.Version.MajorMinor)
.Select(pair => (pair as IEnumerable<Bundle>, LocalizableStrings.MacRuntimeRequirementExplainationString))
.Select(pair => (pair as IEnumerable<Bundle>, LocalizableStrings.MacRuntimeRequirementExplanationString))
.ToDictionary(key => key.Item1, value => value.Item2);

var sdks = bundleList.Where(bundle => bundle.Version is SdkVersion);
if (sdks != null && sdks.Count() > 0)
{
dividedBundles.Add(sdks, LocalizableStrings.MacSDKRequirementExplainationString);
dividedBundles.Add(sdks, LocalizableStrings.MacSDKRequirementExplanationString);
}

var remainingBundles = bundleList
Expand Down
10 changes: 5 additions & 5 deletions src/dotnet-core-uninstall/xlf/LocalizableStrings.cs.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@
<target state="new">Force removal of versions that might be used by Visual Studio.</target>
<note />
</trans-unit>
<trans-unit id="HelpExplainationParagraphMac">
<trans-unit id="HelpExplanationParagraphMac">
<source>(*) By default, SDKs and Runtimes that have a high probability of being used by Visual Studio for Mac or SDKs are not removed. To remove these, specify them individually or use --force. If removing SDKs or Runtimes causes issues with your installation of Visual Studio for Mac, run “Repair”. SDKs and Runtimes are available for download at aka.ms/dotnet-core-download.</source>
<target state="new">(*) By default, SDKs and Runtimes that have a high probability of being used by Visual Studio for Mac or SDKs are not removed. To remove these, specify them individually or use --force. If removing SDKs or Runtimes causes issues with your installation of Visual Studio for Mac, run “Repair”. SDKs and Runtimes are available for download at aka.ms/dotnet-core-download.</target>
<note />
</trans-unit>
<trans-unit id="HelpExplainationParagraphWindows">
<trans-unit id="HelpExplanationParagraphWindows">
<source>(*) By default, SDKs and Runtimes that have a high probability of being used by Visual Studio are not removed. To remove these, specify them individually or use --force. If removing SDKs or Runtimes causes issues with your installation of Visual Studio, run “Repair”. SDKs and Runtimes are available for download at aka.ms/dotnet-core-download.</source>
<target state="new">(*) By default, SDKs and Runtimes that have a high probability of being used by Visual Studio are not removed. To remove these, specify them individually or use --force. If removing SDKs or Runtimes causes issues with your installation of Visual Studio, run “Repair”. SDKs and Runtimes are available for download at aka.ms/dotnet-core-download.</target>
<note />
Expand Down Expand Up @@ -181,12 +181,12 @@ Uninstalling this item will cause Visual Studio for to break.
</target>
<note />
</trans-unit>
<trans-unit id="MacRuntimeRequirementExplainationString">
<trans-unit id="MacRuntimeRequirementExplanationString">
<source>Used by Visual Studio for Mac or SDKs. Specify individually or use —-force to remove</source>
<target state="new">Used by Visual Studio for Mac or SDKs. Specify individually or use —-force to remove</target>
<note />
</trans-unit>
<trans-unit id="MacSDKRequirementExplainationString">
<trans-unit id="MacSDKRequirementExplanationString">
<source>Used by Visual Studio for Mac. Specify individually or use —-force to remove</source>
<target state="new">Used by Visual Studio for Mac. Specify individually or use —-force to remove</target>
<note />
Expand Down Expand Up @@ -463,7 +463,7 @@ Uninstalling this item will cause Visual Studio to break.
</target>
<note />
</trans-unit>
<trans-unit id="WindowsRequirementExplainationString">
<trans-unit id="WindowsRequirementExplanationString">
<source>Used by Visual Studio{0}. Specify individually or use —-force to remove</source>
<target state="new">Used by Visual Studio{0}. Specify individually or use —-force to remove</target>
<note />
Expand Down
10 changes: 5 additions & 5 deletions src/dotnet-core-uninstall/xlf/LocalizableStrings.de.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@
<target state="new">Force removal of versions that might be used by Visual Studio.</target>
<note />
</trans-unit>
<trans-unit id="HelpExplainationParagraphMac">
<trans-unit id="HelpExplanationParagraphMac">
<source>(*) By default, SDKs and Runtimes that have a high probability of being used by Visual Studio for Mac or SDKs are not removed. To remove these, specify them individually or use --force. If removing SDKs or Runtimes causes issues with your installation of Visual Studio for Mac, run “Repair”. SDKs and Runtimes are available for download at aka.ms/dotnet-core-download.</source>
<target state="new">(*) By default, SDKs and Runtimes that have a high probability of being used by Visual Studio for Mac or SDKs are not removed. To remove these, specify them individually or use --force. If removing SDKs or Runtimes causes issues with your installation of Visual Studio for Mac, run “Repair”. SDKs and Runtimes are available for download at aka.ms/dotnet-core-download.</target>
<note />
</trans-unit>
<trans-unit id="HelpExplainationParagraphWindows">
<trans-unit id="HelpExplanationParagraphWindows">
<source>(*) By default, SDKs and Runtimes that have a high probability of being used by Visual Studio are not removed. To remove these, specify them individually or use --force. If removing SDKs or Runtimes causes issues with your installation of Visual Studio, run “Repair”. SDKs and Runtimes are available for download at aka.ms/dotnet-core-download.</source>
<target state="new">(*) By default, SDKs and Runtimes that have a high probability of being used by Visual Studio are not removed. To remove these, specify them individually or use --force. If removing SDKs or Runtimes causes issues with your installation of Visual Studio, run “Repair”. SDKs and Runtimes are available for download at aka.ms/dotnet-core-download.</target>
<note />
Expand Down Expand Up @@ -181,12 +181,12 @@ Uninstalling this item will cause Visual Studio for to break.
</target>
<note />
</trans-unit>
<trans-unit id="MacRuntimeRequirementExplainationString">
<trans-unit id="MacRuntimeRequirementExplanationString">
<source>Used by Visual Studio for Mac or SDKs. Specify individually or use —-force to remove</source>
<target state="new">Used by Visual Studio for Mac or SDKs. Specify individually or use —-force to remove</target>
<note />
</trans-unit>
<trans-unit id="MacSDKRequirementExplainationString">
<trans-unit id="MacSDKRequirementExplanationString">
<source>Used by Visual Studio for Mac. Specify individually or use —-force to remove</source>
<target state="new">Used by Visual Studio for Mac. Specify individually or use —-force to remove</target>
<note />
Expand Down Expand Up @@ -463,7 +463,7 @@ Uninstalling this item will cause Visual Studio to break.
</target>
<note />
</trans-unit>
<trans-unit id="WindowsRequirementExplainationString">
<trans-unit id="WindowsRequirementExplanationString">
<source>Used by Visual Studio{0}. Specify individually or use —-force to remove</source>
<target state="new">Used by Visual Studio{0}. Specify individually or use —-force to remove</target>
<note />
Expand Down
Loading