diff --git a/src/Cli/dotnet/commands/InstallingWorkloadCommand.cs b/src/Cli/dotnet/commands/InstallingWorkloadCommand.cs index d8ca6e0fc51d..bfd2105e20ec 100644 --- a/src/Cli/dotnet/commands/InstallingWorkloadCommand.cs +++ b/src/Cli/dotnet/commands/InstallingWorkloadCommand.cs @@ -244,12 +244,6 @@ protected IEnumerable GetInstalledWorkloads(bool fromPreviousSdk) internal static class InstallingWorkloadCommandParser { - public static readonly CliOption WorkloadSetMode = new("--mode") - { - Description = Strings.WorkloadSetMode, - Hidden = true - }; - public static readonly CliOption WorkloadSetVersionOption = new("--version") { Description = Strings.WorkloadSetVersionOptionDescription diff --git a/src/Cli/dotnet/commands/dotnet-workload/WorkloadCommandParser.cs b/src/Cli/dotnet/commands/dotnet-workload/WorkloadCommandParser.cs index 58a178422aea..27da8f82f71a 100644 --- a/src/Cli/dotnet/commands/dotnet-workload/WorkloadCommandParser.cs +++ b/src/Cli/dotnet/commands/dotnet-workload/WorkloadCommandParser.cs @@ -124,6 +124,7 @@ private static CliCommand ConstructCommand() command.Subcommands.Add(WorkloadRestoreCommandParser.GetCommand()); command.Subcommands.Add(WorkloadCleanCommandParser.GetCommand()); command.Subcommands.Add(WorkloadElevateCommandParser.GetCommand()); + command.Subcommands.Add(WorkloadConfigCommandParser.GetCommand()); command.Validators.Add(commandResult => { diff --git a/src/Cli/dotnet/commands/dotnet-workload/config/LocalizableStrings.resx b/src/Cli/dotnet/commands/dotnet-workload/config/LocalizableStrings.resx new file mode 100644 index 000000000000..4e1d34189dd2 --- /dev/null +++ b/src/Cli/dotnet/commands/dotnet-workload/config/LocalizableStrings.resx @@ -0,0 +1,127 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Modify or display workload configuration values. +To display a value, specify the corresponding command-line option without providing a value. For example: "dotnet workload config --update-mode" + + + Controls whether updates should look for workload sets or the latest version of each individual manifest. + + diff --git a/src/Cli/dotnet/commands/dotnet-workload/config/WorkloadConfigCommand.cs b/src/Cli/dotnet/commands/dotnet-workload/config/WorkloadConfigCommand.cs new file mode 100644 index 000000000000..1923511703e8 --- /dev/null +++ b/src/Cli/dotnet/commands/dotnet-workload/config/WorkloadConfigCommand.cs @@ -0,0 +1,97 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System; +using System.Collections.Generic; +using System.CommandLine; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Microsoft.Deployment.DotNet.Releases; +using Microsoft.DotNet.Cli; +using Microsoft.DotNet.Cli.Utils; +using Microsoft.DotNet.Workloads.Workload; +using Microsoft.DotNet.Workloads.Workload.Install; +using Microsoft.NET.Sdk.WorkloadManifestReader; + +#nullable enable + +namespace Microsoft.DotNet.Workloads.Workload.Config +{ + internal class WorkloadConfigCommand : WorkloadCommandBase + { + private bool _hasUpdateMode; + private string? _updateMode; + private readonly IWorkloadResolverFactory _workloadResolverFactory; + + private string? _dotnetPath; + private string _userProfileDir; + private readonly IWorkloadResolver _workloadResolver; + private readonly ReleaseVersion _sdkVersion; + private readonly SdkFeatureBand _sdkFeatureBand; + + readonly IInstaller _workloadInstaller; + + public WorkloadConfigCommand( + ParseResult parseResult, + IReporter? reporter = null, + IWorkloadResolverFactory? workloadResolverFactory = null + ) : base(parseResult, CommonOptions.HiddenVerbosityOption, reporter) + { + _hasUpdateMode = parseResult.HasOption(WorkloadConfigCommandParser.UpdateMode); + _updateMode = parseResult.GetValue(WorkloadConfigCommandParser.UpdateMode); + + _workloadResolverFactory = workloadResolverFactory ?? new WorkloadResolverFactory(); + + var creationResult = _workloadResolverFactory.Create(); + + _dotnetPath = creationResult.DotnetPath; + _userProfileDir = creationResult.UserProfileDir; + _workloadResolver = creationResult.WorkloadResolver; + _sdkVersion = creationResult.SdkVersion; + + _sdkFeatureBand = new SdkFeatureBand(_sdkVersion); + _workloadInstaller = WorkloadInstallerFactory.GetWorkloadInstaller(Reporter, _sdkFeatureBand, creationResult.WorkloadResolver, Verbosity, creationResult.UserProfileDir, VerifySignatures, PackageDownloader, creationResult.DotnetPath); + } + + public override int Execute() + { + // When we support multiple configuration values, it would be nice if we could process and display them in the order they are passed. + // It seems that the parser doesn't give us a good way to do that, however + if (_hasUpdateMode) + { + if (WorkloadConfigCommandParser.UpdateMode_WorkloadSet.Equals(_updateMode, StringComparison.InvariantCultureIgnoreCase)) + { + _workloadInstaller.UpdateInstallMode(_sdkFeatureBand, true); + } + else if (WorkloadConfigCommandParser.UpdateMode_Manifests.Equals(_updateMode, StringComparison.InvariantCultureIgnoreCase)) + { + _workloadInstaller.UpdateInstallMode(_sdkFeatureBand, false); + } + else if (string.IsNullOrEmpty(_updateMode)) + { + if (InstallingWorkloadCommand.ShouldUseWorkloadSetMode(_sdkFeatureBand, _dotnetPath)) + { + Reporter.WriteLine(WorkloadConfigCommandParser.UpdateMode_WorkloadSet); + } + else + { + Reporter.WriteLine(WorkloadConfigCommandParser.UpdateMode_Manifests); + } + } + else + { + // This should not be hit, as parser sets the accepted values and should error before getting here if the value is not valid + throw new InvalidOperationException($"Invalid update mode: {_updateMode}"); + } + } + else + { + _parseResult.ShowHelp(); + } + + return 0; + } + } + +} diff --git a/src/Cli/dotnet/commands/dotnet-workload/config/WorkloadConfigCommandParser.cs b/src/Cli/dotnet/commands/dotnet-workload/config/WorkloadConfigCommandParser.cs new file mode 100644 index 000000000000..22114beef478 --- /dev/null +++ b/src/Cli/dotnet/commands/dotnet-workload/config/WorkloadConfigCommandParser.cs @@ -0,0 +1,44 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System.CommandLine; +using Microsoft.DotNet.Workloads.Workload.Config; + +namespace Microsoft.DotNet.Cli +{ + internal static class WorkloadConfigCommandParser + { + // dotnet workload config --update-mode workload-set + + public static readonly string UpdateMode_WorkloadSet = "workload-set"; + public static readonly string UpdateMode_Manifests = "manifests"; + + public static readonly CliOption UpdateMode = new("--update-mode") + { + Description = LocalizableStrings.UpdateModeDescription, + Arity = ArgumentArity.ZeroOrOne + }; + + private static readonly CliCommand Command = ConstructCommand(); + + public static CliCommand GetCommand() + { + return Command; + } + + private static CliCommand ConstructCommand() + { + UpdateMode.AcceptOnlyFromAmong(UpdateMode_WorkloadSet, UpdateMode_Manifests); + + CliCommand command = new("config", LocalizableStrings.CommandDescription); + command.Options.Add(UpdateMode); + + command.SetAction(parseResult => + { + new WorkloadConfigCommand(parseResult).Execute(); + }); + + return command; + } + } +} diff --git a/src/Cli/dotnet/commands/dotnet-workload/config/xlf/LocalizableStrings.cs.xlf b/src/Cli/dotnet/commands/dotnet-workload/config/xlf/LocalizableStrings.cs.xlf new file mode 100644 index 000000000000..8d6be7eaaf81 --- /dev/null +++ b/src/Cli/dotnet/commands/dotnet-workload/config/xlf/LocalizableStrings.cs.xlf @@ -0,0 +1,19 @@ + + + + + + Modify or display workload configuration values. +To display a value, specify the corresponding command-line option without providing a value. For example: "dotnet workload config --update-mode" + Modify or display workload configuration values. +To display a value, specify the corresponding command-line option without providing a value. For example: "dotnet workload config --update-mode" + + + + Controls whether updates should look for workload sets or the latest version of each individual manifest. + Controls whether updates should look for workload sets or the latest version of each individual manifest. + + + + + \ No newline at end of file diff --git a/src/Cli/dotnet/commands/dotnet-workload/config/xlf/LocalizableStrings.de.xlf b/src/Cli/dotnet/commands/dotnet-workload/config/xlf/LocalizableStrings.de.xlf new file mode 100644 index 000000000000..88aee0f67512 --- /dev/null +++ b/src/Cli/dotnet/commands/dotnet-workload/config/xlf/LocalizableStrings.de.xlf @@ -0,0 +1,19 @@ + + + + + + Modify or display workload configuration values. +To display a value, specify the corresponding command-line option without providing a value. For example: "dotnet workload config --update-mode" + Modify or display workload configuration values. +To display a value, specify the corresponding command-line option without providing a value. For example: "dotnet workload config --update-mode" + + + + Controls whether updates should look for workload sets or the latest version of each individual manifest. + Controls whether updates should look for workload sets or the latest version of each individual manifest. + + + + + \ No newline at end of file diff --git a/src/Cli/dotnet/commands/dotnet-workload/config/xlf/LocalizableStrings.es.xlf b/src/Cli/dotnet/commands/dotnet-workload/config/xlf/LocalizableStrings.es.xlf new file mode 100644 index 000000000000..55b10d407fc2 --- /dev/null +++ b/src/Cli/dotnet/commands/dotnet-workload/config/xlf/LocalizableStrings.es.xlf @@ -0,0 +1,19 @@ + + + + + + Modify or display workload configuration values. +To display a value, specify the corresponding command-line option without providing a value. For example: "dotnet workload config --update-mode" + Modify or display workload configuration values. +To display a value, specify the corresponding command-line option without providing a value. For example: "dotnet workload config --update-mode" + + + + Controls whether updates should look for workload sets or the latest version of each individual manifest. + Controls whether updates should look for workload sets or the latest version of each individual manifest. + + + + + \ No newline at end of file diff --git a/src/Cli/dotnet/commands/dotnet-workload/config/xlf/LocalizableStrings.fr.xlf b/src/Cli/dotnet/commands/dotnet-workload/config/xlf/LocalizableStrings.fr.xlf new file mode 100644 index 000000000000..c7cc788430d4 --- /dev/null +++ b/src/Cli/dotnet/commands/dotnet-workload/config/xlf/LocalizableStrings.fr.xlf @@ -0,0 +1,19 @@ + + + + + + Modify or display workload configuration values. +To display a value, specify the corresponding command-line option without providing a value. For example: "dotnet workload config --update-mode" + Modify or display workload configuration values. +To display a value, specify the corresponding command-line option without providing a value. For example: "dotnet workload config --update-mode" + + + + Controls whether updates should look for workload sets or the latest version of each individual manifest. + Controls whether updates should look for workload sets or the latest version of each individual manifest. + + + + + \ No newline at end of file diff --git a/src/Cli/dotnet/commands/dotnet-workload/config/xlf/LocalizableStrings.it.xlf b/src/Cli/dotnet/commands/dotnet-workload/config/xlf/LocalizableStrings.it.xlf new file mode 100644 index 000000000000..ba98130db0bf --- /dev/null +++ b/src/Cli/dotnet/commands/dotnet-workload/config/xlf/LocalizableStrings.it.xlf @@ -0,0 +1,19 @@ + + + + + + Modify or display workload configuration values. +To display a value, specify the corresponding command-line option without providing a value. For example: "dotnet workload config --update-mode" + Modify or display workload configuration values. +To display a value, specify the corresponding command-line option without providing a value. For example: "dotnet workload config --update-mode" + + + + Controls whether updates should look for workload sets or the latest version of each individual manifest. + Controls whether updates should look for workload sets or the latest version of each individual manifest. + + + + + \ No newline at end of file diff --git a/src/Cli/dotnet/commands/dotnet-workload/config/xlf/LocalizableStrings.ja.xlf b/src/Cli/dotnet/commands/dotnet-workload/config/xlf/LocalizableStrings.ja.xlf new file mode 100644 index 000000000000..882fdf49f5d9 --- /dev/null +++ b/src/Cli/dotnet/commands/dotnet-workload/config/xlf/LocalizableStrings.ja.xlf @@ -0,0 +1,19 @@ + + + + + + Modify or display workload configuration values. +To display a value, specify the corresponding command-line option without providing a value. For example: "dotnet workload config --update-mode" + Modify or display workload configuration values. +To display a value, specify the corresponding command-line option without providing a value. For example: "dotnet workload config --update-mode" + + + + Controls whether updates should look for workload sets or the latest version of each individual manifest. + Controls whether updates should look for workload sets or the latest version of each individual manifest. + + + + + \ No newline at end of file diff --git a/src/Cli/dotnet/commands/dotnet-workload/config/xlf/LocalizableStrings.ko.xlf b/src/Cli/dotnet/commands/dotnet-workload/config/xlf/LocalizableStrings.ko.xlf new file mode 100644 index 000000000000..b8773e9b116c --- /dev/null +++ b/src/Cli/dotnet/commands/dotnet-workload/config/xlf/LocalizableStrings.ko.xlf @@ -0,0 +1,19 @@ + + + + + + Modify or display workload configuration values. +To display a value, specify the corresponding command-line option without providing a value. For example: "dotnet workload config --update-mode" + Modify or display workload configuration values. +To display a value, specify the corresponding command-line option without providing a value. For example: "dotnet workload config --update-mode" + + + + Controls whether updates should look for workload sets or the latest version of each individual manifest. + Controls whether updates should look for workload sets or the latest version of each individual manifest. + + + + + \ No newline at end of file diff --git a/src/Cli/dotnet/commands/dotnet-workload/config/xlf/LocalizableStrings.pl.xlf b/src/Cli/dotnet/commands/dotnet-workload/config/xlf/LocalizableStrings.pl.xlf new file mode 100644 index 000000000000..06ccf667f917 --- /dev/null +++ b/src/Cli/dotnet/commands/dotnet-workload/config/xlf/LocalizableStrings.pl.xlf @@ -0,0 +1,19 @@ + + + + + + Modify or display workload configuration values. +To display a value, specify the corresponding command-line option without providing a value. For example: "dotnet workload config --update-mode" + Modify or display workload configuration values. +To display a value, specify the corresponding command-line option without providing a value. For example: "dotnet workload config --update-mode" + + + + Controls whether updates should look for workload sets or the latest version of each individual manifest. + Controls whether updates should look for workload sets or the latest version of each individual manifest. + + + + + \ No newline at end of file diff --git a/src/Cli/dotnet/commands/dotnet-workload/config/xlf/LocalizableStrings.pt-BR.xlf b/src/Cli/dotnet/commands/dotnet-workload/config/xlf/LocalizableStrings.pt-BR.xlf new file mode 100644 index 000000000000..27459bb8c5fb --- /dev/null +++ b/src/Cli/dotnet/commands/dotnet-workload/config/xlf/LocalizableStrings.pt-BR.xlf @@ -0,0 +1,19 @@ + + + + + + Modify or display workload configuration values. +To display a value, specify the corresponding command-line option without providing a value. For example: "dotnet workload config --update-mode" + Modify or display workload configuration values. +To display a value, specify the corresponding command-line option without providing a value. For example: "dotnet workload config --update-mode" + + + + Controls whether updates should look for workload sets or the latest version of each individual manifest. + Controls whether updates should look for workload sets or the latest version of each individual manifest. + + + + + \ No newline at end of file diff --git a/src/Cli/dotnet/commands/dotnet-workload/config/xlf/LocalizableStrings.ru.xlf b/src/Cli/dotnet/commands/dotnet-workload/config/xlf/LocalizableStrings.ru.xlf new file mode 100644 index 000000000000..5a490dbba2f5 --- /dev/null +++ b/src/Cli/dotnet/commands/dotnet-workload/config/xlf/LocalizableStrings.ru.xlf @@ -0,0 +1,19 @@ + + + + + + Modify or display workload configuration values. +To display a value, specify the corresponding command-line option without providing a value. For example: "dotnet workload config --update-mode" + Modify or display workload configuration values. +To display a value, specify the corresponding command-line option without providing a value. For example: "dotnet workload config --update-mode" + + + + Controls whether updates should look for workload sets or the latest version of each individual manifest. + Controls whether updates should look for workload sets or the latest version of each individual manifest. + + + + + \ No newline at end of file diff --git a/src/Cli/dotnet/commands/dotnet-workload/config/xlf/LocalizableStrings.tr.xlf b/src/Cli/dotnet/commands/dotnet-workload/config/xlf/LocalizableStrings.tr.xlf new file mode 100644 index 000000000000..07fe44de371f --- /dev/null +++ b/src/Cli/dotnet/commands/dotnet-workload/config/xlf/LocalizableStrings.tr.xlf @@ -0,0 +1,19 @@ + + + + + + Modify or display workload configuration values. +To display a value, specify the corresponding command-line option without providing a value. For example: "dotnet workload config --update-mode" + Modify or display workload configuration values. +To display a value, specify the corresponding command-line option without providing a value. For example: "dotnet workload config --update-mode" + + + + Controls whether updates should look for workload sets or the latest version of each individual manifest. + Controls whether updates should look for workload sets or the latest version of each individual manifest. + + + + + \ No newline at end of file diff --git a/src/Cli/dotnet/commands/dotnet-workload/config/xlf/LocalizableStrings.zh-Hans.xlf b/src/Cli/dotnet/commands/dotnet-workload/config/xlf/LocalizableStrings.zh-Hans.xlf new file mode 100644 index 000000000000..41a4543b7566 --- /dev/null +++ b/src/Cli/dotnet/commands/dotnet-workload/config/xlf/LocalizableStrings.zh-Hans.xlf @@ -0,0 +1,19 @@ + + + + + + Modify or display workload configuration values. +To display a value, specify the corresponding command-line option without providing a value. For example: "dotnet workload config --update-mode" + Modify or display workload configuration values. +To display a value, specify the corresponding command-line option without providing a value. For example: "dotnet workload config --update-mode" + + + + Controls whether updates should look for workload sets or the latest version of each individual manifest. + Controls whether updates should look for workload sets or the latest version of each individual manifest. + + + + + \ No newline at end of file diff --git a/src/Cli/dotnet/commands/dotnet-workload/config/xlf/LocalizableStrings.zh-Hant.xlf b/src/Cli/dotnet/commands/dotnet-workload/config/xlf/LocalizableStrings.zh-Hant.xlf new file mode 100644 index 000000000000..8a8598849d60 --- /dev/null +++ b/src/Cli/dotnet/commands/dotnet-workload/config/xlf/LocalizableStrings.zh-Hant.xlf @@ -0,0 +1,19 @@ + + + + + + Modify or display workload configuration values. +To display a value, specify the corresponding command-line option without providing a value. For example: "dotnet workload config --update-mode" + Modify or display workload configuration values. +To display a value, specify the corresponding command-line option without providing a value. For example: "dotnet workload config --update-mode" + + + + Controls whether updates should look for workload sets or the latest version of each individual manifest. + Controls whether updates should look for workload sets or the latest version of each individual manifest. + + + + + \ No newline at end of file diff --git a/src/Cli/dotnet/commands/dotnet-workload/install/LocalizableStrings.resx b/src/Cli/dotnet/commands/dotnet-workload/install/LocalizableStrings.resx index 6fddf990e564..bfe6c150700e 100644 --- a/src/Cli/dotnet/commands/dotnet-workload/install/LocalizableStrings.resx +++ b/src/Cli/dotnet/commands/dotnet-workload/install/LocalizableStrings.resx @@ -183,9 +183,6 @@ Only print the list of links to download without downloading. - - Control whether future workload operations should use workload sets or loose manifests. - Download packages needed to install a workload to a folder that can be used for offline installation. diff --git a/src/Cli/dotnet/commands/dotnet-workload/install/xlf/LocalizableStrings.cs.xlf b/src/Cli/dotnet/commands/dotnet-workload/install/xlf/LocalizableStrings.cs.xlf index 16d19acff6fe..3b0ee189aa14 100644 --- a/src/Cli/dotnet/commands/dotnet-workload/install/xlf/LocalizableStrings.cs.xlf +++ b/src/Cli/dotnet/commands/dotnet-workload/install/xlf/LocalizableStrings.cs.xlf @@ -367,11 +367,6 @@ CESTA - - Control whether future workload operations should use workload sets or loose manifests. - Určete, jestli by budoucí operace úloh měly používat sady úloh nebo volné manifesty. - - Updating workload version from {0} to {1}. Updating workload version from {0} to {1}. diff --git a/src/Cli/dotnet/commands/dotnet-workload/install/xlf/LocalizableStrings.de.xlf b/src/Cli/dotnet/commands/dotnet-workload/install/xlf/LocalizableStrings.de.xlf index 3684392e233f..79beb04dd911 100644 --- a/src/Cli/dotnet/commands/dotnet-workload/install/xlf/LocalizableStrings.de.xlf +++ b/src/Cli/dotnet/commands/dotnet-workload/install/xlf/LocalizableStrings.de.xlf @@ -367,11 +367,6 @@ PFAD - - Control whether future workload operations should use workload sets or loose manifests. - Hiermit wird gesteuert, ob zukünftige Workloadvorgänge Workloadsätze oder lose Manifeste verwenden sollen. - - Updating workload version from {0} to {1}. Updating workload version from {0} to {1}. diff --git a/src/Cli/dotnet/commands/dotnet-workload/install/xlf/LocalizableStrings.es.xlf b/src/Cli/dotnet/commands/dotnet-workload/install/xlf/LocalizableStrings.es.xlf index b85299b2a989..3ff2eb6c719f 100644 --- a/src/Cli/dotnet/commands/dotnet-workload/install/xlf/LocalizableStrings.es.xlf +++ b/src/Cli/dotnet/commands/dotnet-workload/install/xlf/LocalizableStrings.es.xlf @@ -367,11 +367,6 @@ RUTA DE ACCESO - - Control whether future workload operations should use workload sets or loose manifests. - Controle si las operaciones de carga de trabajo futuras deben usar conjuntos de cargas de trabajo o manifiestos flexibles. - - Updating workload version from {0} to {1}. Updating workload version from {0} to {1}. diff --git a/src/Cli/dotnet/commands/dotnet-workload/install/xlf/LocalizableStrings.fr.xlf b/src/Cli/dotnet/commands/dotnet-workload/install/xlf/LocalizableStrings.fr.xlf index 22f5c5ee64e0..e2bb3b3ead0f 100644 --- a/src/Cli/dotnet/commands/dotnet-workload/install/xlf/LocalizableStrings.fr.xlf +++ b/src/Cli/dotnet/commands/dotnet-workload/install/xlf/LocalizableStrings.fr.xlf @@ -367,11 +367,6 @@ PATH - - Control whether future workload operations should use workload sets or loose manifests. - Contrôlez si les futures opérations de charge de travail doivent utiliser des ensembles de charges de travail ou des manifestes lâches. - - Updating workload version from {0} to {1}. Updating workload version from {0} to {1}. diff --git a/src/Cli/dotnet/commands/dotnet-workload/install/xlf/LocalizableStrings.it.xlf b/src/Cli/dotnet/commands/dotnet-workload/install/xlf/LocalizableStrings.it.xlf index 0f2b45bf6774..a7a7328e2993 100644 --- a/src/Cli/dotnet/commands/dotnet-workload/install/xlf/LocalizableStrings.it.xlf +++ b/src/Cli/dotnet/commands/dotnet-workload/install/xlf/LocalizableStrings.it.xlf @@ -367,11 +367,6 @@ PERCORSO - - Control whether future workload operations should use workload sets or loose manifests. - Controllare se le operazioni future del carico di lavoro devono usare set di carichi di lavoro o manifesti separati. - - Updating workload version from {0} to {1}. Updating workload version from {0} to {1}. diff --git a/src/Cli/dotnet/commands/dotnet-workload/install/xlf/LocalizableStrings.ja.xlf b/src/Cli/dotnet/commands/dotnet-workload/install/xlf/LocalizableStrings.ja.xlf index 029a1695d244..6241ce57e807 100644 --- a/src/Cli/dotnet/commands/dotnet-workload/install/xlf/LocalizableStrings.ja.xlf +++ b/src/Cli/dotnet/commands/dotnet-workload/install/xlf/LocalizableStrings.ja.xlf @@ -367,11 +367,6 @@ パス - - Control whether future workload operations should use workload sets or loose manifests. - 将来のワークロード操作でワークロード セットを使用するか、ルーズ マニフェストを使用するかを制御します。 - - Updating workload version from {0} to {1}. Updating workload version from {0} to {1}. diff --git a/src/Cli/dotnet/commands/dotnet-workload/install/xlf/LocalizableStrings.ko.xlf b/src/Cli/dotnet/commands/dotnet-workload/install/xlf/LocalizableStrings.ko.xlf index 928954891bfd..09611c820b4d 100644 --- a/src/Cli/dotnet/commands/dotnet-workload/install/xlf/LocalizableStrings.ko.xlf +++ b/src/Cli/dotnet/commands/dotnet-workload/install/xlf/LocalizableStrings.ko.xlf @@ -367,11 +367,6 @@ 경로 - - Control whether future workload operations should use workload sets or loose manifests. - 향후 워크로드 작업에서 워크로드 집합을 사용할지, 매니페스트를 완화할지를 제어합니다. - - Updating workload version from {0} to {1}. Updating workload version from {0} to {1}. diff --git a/src/Cli/dotnet/commands/dotnet-workload/install/xlf/LocalizableStrings.pl.xlf b/src/Cli/dotnet/commands/dotnet-workload/install/xlf/LocalizableStrings.pl.xlf index b2fc232366d5..1ab3e727fdb4 100644 --- a/src/Cli/dotnet/commands/dotnet-workload/install/xlf/LocalizableStrings.pl.xlf +++ b/src/Cli/dotnet/commands/dotnet-workload/install/xlf/LocalizableStrings.pl.xlf @@ -367,11 +367,6 @@ ŚCIEŻKA - - Control whether future workload operations should use workload sets or loose manifests. - Określ, czy przyszłe operacje związane z obciążeniami powinny wykorzystywać zestawy obciążeń, czy luźne manifesty. - - Updating workload version from {0} to {1}. Updating workload version from {0} to {1}. diff --git a/src/Cli/dotnet/commands/dotnet-workload/install/xlf/LocalizableStrings.pt-BR.xlf b/src/Cli/dotnet/commands/dotnet-workload/install/xlf/LocalizableStrings.pt-BR.xlf index f28bacbe2588..00ada3f1ade8 100644 --- a/src/Cli/dotnet/commands/dotnet-workload/install/xlf/LocalizableStrings.pt-BR.xlf +++ b/src/Cli/dotnet/commands/dotnet-workload/install/xlf/LocalizableStrings.pt-BR.xlf @@ -367,11 +367,6 @@ CAMINHO - - Control whether future workload operations should use workload sets or loose manifests. - Controle se as operações de carga de trabalho futuras devem usar conjuntos de carga de trabalho ou manifestos flexíveis. - - Updating workload version from {0} to {1}. Updating workload version from {0} to {1}. diff --git a/src/Cli/dotnet/commands/dotnet-workload/install/xlf/LocalizableStrings.ru.xlf b/src/Cli/dotnet/commands/dotnet-workload/install/xlf/LocalizableStrings.ru.xlf index ed236e9b4434..456b61496459 100644 --- a/src/Cli/dotnet/commands/dotnet-workload/install/xlf/LocalizableStrings.ru.xlf +++ b/src/Cli/dotnet/commands/dotnet-workload/install/xlf/LocalizableStrings.ru.xlf @@ -367,11 +367,6 @@ PATH - - Control whether future workload operations should use workload sets or loose manifests. - Укажите, должны ли будущие операции рабочей нагрузки использовать наборы рабочей нагрузки или свободные манифесты. - - Updating workload version from {0} to {1}. Updating workload version from {0} to {1}. diff --git a/src/Cli/dotnet/commands/dotnet-workload/install/xlf/LocalizableStrings.tr.xlf b/src/Cli/dotnet/commands/dotnet-workload/install/xlf/LocalizableStrings.tr.xlf index 8bfc444dd456..ab2421a85a12 100644 --- a/src/Cli/dotnet/commands/dotnet-workload/install/xlf/LocalizableStrings.tr.xlf +++ b/src/Cli/dotnet/commands/dotnet-workload/install/xlf/LocalizableStrings.tr.xlf @@ -367,11 +367,6 @@ YOL - - Control whether future workload operations should use workload sets or loose manifests. - Gelecekteki iş yükü işlemlerinin iş yükü kümelerini mi yoksa gevşek bildirimleri mi kullanması gerektiğini kontrol edin. - - Updating workload version from {0} to {1}. Updating workload version from {0} to {1}. diff --git a/src/Cli/dotnet/commands/dotnet-workload/install/xlf/LocalizableStrings.zh-Hans.xlf b/src/Cli/dotnet/commands/dotnet-workload/install/xlf/LocalizableStrings.zh-Hans.xlf index afc5f7b4f3d7..843c9bf309bd 100644 --- a/src/Cli/dotnet/commands/dotnet-workload/install/xlf/LocalizableStrings.zh-Hans.xlf +++ b/src/Cli/dotnet/commands/dotnet-workload/install/xlf/LocalizableStrings.zh-Hans.xlf @@ -367,11 +367,6 @@ 路径 - - Control whether future workload operations should use workload sets or loose manifests. - 控制未来的工作负载操作应该使用工作负载集还是松散清单。 - - Updating workload version from {0} to {1}. Updating workload version from {0} to {1}. diff --git a/src/Cli/dotnet/commands/dotnet-workload/install/xlf/LocalizableStrings.zh-Hant.xlf b/src/Cli/dotnet/commands/dotnet-workload/install/xlf/LocalizableStrings.zh-Hant.xlf index b1c547749558..e0738c7e1d86 100644 --- a/src/Cli/dotnet/commands/dotnet-workload/install/xlf/LocalizableStrings.zh-Hant.xlf +++ b/src/Cli/dotnet/commands/dotnet-workload/install/xlf/LocalizableStrings.zh-Hant.xlf @@ -367,11 +367,6 @@ 路徑 - - Control whether future workload operations should use workload sets or loose manifests. - 控制未來的工作負載作業應該使用工作負載集合還是鬆散資訊清單。 - - Updating workload version from {0} to {1}. Updating workload version from {0} to {1}. diff --git a/src/Cli/dotnet/commands/dotnet-workload/update/LocalizableStrings.resx b/src/Cli/dotnet/commands/dotnet-workload/update/LocalizableStrings.resx index 58a400e6ede6..7121fc1dab52 100644 --- a/src/Cli/dotnet/commands/dotnet-workload/update/LocalizableStrings.resx +++ b/src/Cli/dotnet/commands/dotnet-workload/update/LocalizableStrings.resx @@ -138,9 +138,6 @@ Workload update failed: {0} - - Invalid argument "{0}" to the --mode argument for dotnet workload update. Only supported modes are "workloadset", "loosemanifest", and "auto". - Include workloads installed with earlier SDK versions in update. @@ -159,4 +156,4 @@ Updating to a rollback file is not compatible with workload sets. Install and Update will now use loose manifests. To update to a specific workload version, use --version. - \ No newline at end of file + diff --git a/src/Cli/dotnet/commands/dotnet-workload/update/WorkloadUpdateCommand.cs b/src/Cli/dotnet/commands/dotnet-workload/update/WorkloadUpdateCommand.cs index 0d14b1fc84f7..0305f2370e26 100644 --- a/src/Cli/dotnet/commands/dotnet-workload/update/WorkloadUpdateCommand.cs +++ b/src/Cli/dotnet/commands/dotnet-workload/update/WorkloadUpdateCommand.cs @@ -22,8 +22,6 @@ internal class WorkloadUpdateCommand : InstallingWorkloadCommand private readonly bool _adManifestOnlyOption; private readonly bool _printRollbackDefinitionOnly; private readonly bool _fromPreviousSdk; - private readonly string _workloadSetMode; - public WorkloadUpdateCommand( ParseResult parseResult, IReporter reporter = null, @@ -41,7 +39,6 @@ public WorkloadUpdateCommand( _fromPreviousSdk = parseResult.GetValue(WorkloadUpdateCommandParser.FromPreviousSdkOption); _adManifestOnlyOption = parseResult.GetValue(WorkloadUpdateCommandParser.AdManifestOnlyOption); _printRollbackDefinitionOnly = parseResult.GetValue(WorkloadUpdateCommandParser.PrintRollbackOption); - _workloadSetMode = parseResult.GetValue(InstallingWorkloadCommandParser.WorkloadSetMode); _workloadInstaller = _workloadInstallerFromConstructor ?? WorkloadInstallerFactory.GetWorkloadInstaller(Reporter, _sdkFeatureBand, _workloadResolver, Verbosity, _userProfileDir, VerifySignatures, PackageDownloader, @@ -92,22 +89,6 @@ public override int Execute() Reporter.WriteLine(workloadSet.ToJson()); Reporter.WriteLine("==workloadRollbackDefinitionJsonOutputEnd=="); } - else if (!string.IsNullOrWhiteSpace(_workloadSetMode)) - { - if (_workloadSetMode.Equals("workloadset", StringComparison.OrdinalIgnoreCase)) - { - _workloadInstaller.UpdateInstallMode(_sdkFeatureBand, true); - } - else if (_workloadSetMode.Equals("loosemanifest", StringComparison.OrdinalIgnoreCase) || - _workloadSetMode.Equals("auto", StringComparison.OrdinalIgnoreCase)) - { - _workloadInstaller.UpdateInstallMode(_sdkFeatureBand, false); - } - else - { - throw new GracefulException(string.Format(LocalizableStrings.WorkloadSetModeTakesWorkloadSetLooseManifestOrAuto, _workloadSetMode), isUserError: true); - } - } else { try diff --git a/src/Cli/dotnet/commands/dotnet-workload/update/WorkloadUpdateCommandParser.cs b/src/Cli/dotnet/commands/dotnet-workload/update/WorkloadUpdateCommandParser.cs index 787189013bb4..bd88463095eb 100644 --- a/src/Cli/dotnet/commands/dotnet-workload/update/WorkloadUpdateCommandParser.cs +++ b/src/Cli/dotnet/commands/dotnet-workload/update/WorkloadUpdateCommandParser.cs @@ -48,7 +48,6 @@ private static CliCommand ConstructCommand() command.Options.Add(CommonOptions.VerbosityOption); command.Options.Add(PrintRollbackOption); command.Options.Add(WorkloadInstallCommandParser.SkipSignCheckOption); - command.Options.Add(InstallingWorkloadCommandParser.WorkloadSetMode); command.SetAction((parseResult) => new WorkloadUpdateCommand(parseResult).Execute()); diff --git a/src/Cli/dotnet/commands/dotnet-workload/update/xlf/LocalizableStrings.cs.xlf b/src/Cli/dotnet/commands/dotnet-workload/update/xlf/LocalizableStrings.cs.xlf index 0cc940248598..7125df25b2ae 100644 --- a/src/Cli/dotnet/commands/dotnet-workload/update/xlf/LocalizableStrings.cs.xlf +++ b/src/Cli/dotnet/commands/dotnet-workload/update/xlf/LocalizableStrings.cs.xlf @@ -57,11 +57,6 @@ Nepovedlo se stáhnout balíčky aktualizace úlohy do mezipaměti: {0}. - - Invalid argument "{0}" to the --mode argument for dotnet workload update. Only supported modes are "workloadset", "loosemanifest", and "auto". - Neplatný argument „{0}“ argumentu --mode pro aktualizaci úlohy dotnet. Jediné podporované režimy jsou workloadset, loosemanifest a auto. - - Successfully updated advertising manifests. Manifesty reklamy se úspěšně aktualizovaly. diff --git a/src/Cli/dotnet/commands/dotnet-workload/update/xlf/LocalizableStrings.de.xlf b/src/Cli/dotnet/commands/dotnet-workload/update/xlf/LocalizableStrings.de.xlf index eec11ddc74e8..18e5032a2459 100644 --- a/src/Cli/dotnet/commands/dotnet-workload/update/xlf/LocalizableStrings.de.xlf +++ b/src/Cli/dotnet/commands/dotnet-workload/update/xlf/LocalizableStrings.de.xlf @@ -57,11 +57,6 @@ Fehler beim Herunterladen von Paketen zur Workloadaktualisierung in den Cache: {0} - - Invalid argument "{0}" to the --mode argument for dotnet workload update. Only supported modes are "workloadset", "loosemanifest", and "auto". - Ungültiges Argument "{0}" zum Argument --mode für das Dotnet Workload-Update. Es werden nur die Modi "workloadset", "loosemanifest" und "auto" unterstützt. - - Successfully updated advertising manifests. Werbemanifeste wurden erfolgreich aktualisiert. diff --git a/src/Cli/dotnet/commands/dotnet-workload/update/xlf/LocalizableStrings.es.xlf b/src/Cli/dotnet/commands/dotnet-workload/update/xlf/LocalizableStrings.es.xlf index 5fd3c603769c..1245d9431375 100644 --- a/src/Cli/dotnet/commands/dotnet-workload/update/xlf/LocalizableStrings.es.xlf +++ b/src/Cli/dotnet/commands/dotnet-workload/update/xlf/LocalizableStrings.es.xlf @@ -57,11 +57,6 @@ No se pudieron descargar los paquetes de actualización de la carga de trabajo en caché: {0} - - Invalid argument "{0}" to the --mode argument for dotnet workload update. Only supported modes are "workloadset", "loosemanifest", and "auto". - Argumento "{0}" no válido para el argumento --mode para la actualización de la carga de trabajo de dotnet. Solo los modos admitidos son "workloadset", "loosemanifest" y "auto". - - Successfully updated advertising manifests. Los manifiestos de publicidad se han actualizado correctamente. diff --git a/src/Cli/dotnet/commands/dotnet-workload/update/xlf/LocalizableStrings.fr.xlf b/src/Cli/dotnet/commands/dotnet-workload/update/xlf/LocalizableStrings.fr.xlf index 767a9f67a439..cb9f7cd68b17 100644 --- a/src/Cli/dotnet/commands/dotnet-workload/update/xlf/LocalizableStrings.fr.xlf +++ b/src/Cli/dotnet/commands/dotnet-workload/update/xlf/LocalizableStrings.fr.xlf @@ -57,11 +57,6 @@ Échec du téléchargement des packages de mise à jour de charge de travail dans le cache : {0} - - Invalid argument "{0}" to the --mode argument for dotnet workload update. Only supported modes are "workloadset", "loosemanifest", and "auto". - Argument «{0}» non valide à l’argument --mode pour la mise à jour de charge de travail dotnet. Seuls les modes pris en charge sont « workloadset », « loosemanifest » et « auto ». - - Successfully updated advertising manifests. Les manifestes de publicité ont été mis à jour. diff --git a/src/Cli/dotnet/commands/dotnet-workload/update/xlf/LocalizableStrings.it.xlf b/src/Cli/dotnet/commands/dotnet-workload/update/xlf/LocalizableStrings.it.xlf index f3d40db0dc9b..182c420a0520 100644 --- a/src/Cli/dotnet/commands/dotnet-workload/update/xlf/LocalizableStrings.it.xlf +++ b/src/Cli/dotnet/commands/dotnet-workload/update/xlf/LocalizableStrings.it.xlf @@ -57,11 +57,6 @@ Non è stato possibile scaricare i pacchetti di aggiornamento del carico di lavoro nella cache: {0} - - Invalid argument "{0}" to the --mode argument for dotnet workload update. Only supported modes are "workloadset", "loosemanifest", and "auto". - Argomento non valido "{0}" per l'argomento --mode per l'aggiornamento del carico di lavoro dotnet. Le uniche modalità supportate sono "workloadset", "loosemanifest" e "auto". - - Successfully updated advertising manifests. I manifesti pubblicitari sono stati aggiornati. diff --git a/src/Cli/dotnet/commands/dotnet-workload/update/xlf/LocalizableStrings.ja.xlf b/src/Cli/dotnet/commands/dotnet-workload/update/xlf/LocalizableStrings.ja.xlf index 27a35287eee3..3ca35116a279 100644 --- a/src/Cli/dotnet/commands/dotnet-workload/update/xlf/LocalizableStrings.ja.xlf +++ b/src/Cli/dotnet/commands/dotnet-workload/update/xlf/LocalizableStrings.ja.xlf @@ -57,11 +57,6 @@ ワークロード更新パッケージをキャッシュにダウンロードできませんでした: {0} - - Invalid argument "{0}" to the --mode argument for dotnet workload update. Only supported modes are "workloadset", "loosemanifest", and "auto". - .NET ワークロード更新の --mode 引数に対する引数 "{0}" が無効です。サポートされているモードは、"workloadset"、"loosemanifest"、および "auto" のみです。 - - Successfully updated advertising manifests. 広告マニフェストを正常に更新しました。 diff --git a/src/Cli/dotnet/commands/dotnet-workload/update/xlf/LocalizableStrings.ko.xlf b/src/Cli/dotnet/commands/dotnet-workload/update/xlf/LocalizableStrings.ko.xlf index 2dcea44b5860..2df917fdfa2e 100644 --- a/src/Cli/dotnet/commands/dotnet-workload/update/xlf/LocalizableStrings.ko.xlf +++ b/src/Cli/dotnet/commands/dotnet-workload/update/xlf/LocalizableStrings.ko.xlf @@ -57,11 +57,6 @@ 캐시할 워크로드 업데이트 패키지를 다운로드하지 못했습니다. {0} - - Invalid argument "{0}" to the --mode argument for dotnet workload update. Only supported modes are "workloadset", "loosemanifest", and "auto". - dotnet 워크로드 업데이트의 --mode 인수에 대한 "{0}" 인수가 잘못되었습니다. "workloadset", "loosemanifest", "auto" 모드만 지원됩니다. - - Successfully updated advertising manifests. 알림 매니페스트를 업데이트했습니다. diff --git a/src/Cli/dotnet/commands/dotnet-workload/update/xlf/LocalizableStrings.pl.xlf b/src/Cli/dotnet/commands/dotnet-workload/update/xlf/LocalizableStrings.pl.xlf index 96c9a3f67371..05dc22760fee 100644 --- a/src/Cli/dotnet/commands/dotnet-workload/update/xlf/LocalizableStrings.pl.xlf +++ b/src/Cli/dotnet/commands/dotnet-workload/update/xlf/LocalizableStrings.pl.xlf @@ -57,11 +57,6 @@ Nie można pobrać pakietów aktualizacji pakietów roboczych do pamięci podręcznej: {0} - - Invalid argument "{0}" to the --mode argument for dotnet workload update. Only supported modes are "workloadset", "loosemanifest", and "auto". - Nieprawidłowy argument „{0}” argumentu --mode dla aktualizacji obciążenia dotnet. Obsługiwane tryby to „workloadset”, „loosemanifest” i „auto”. - - Successfully updated advertising manifests. Pomyślnie zaktualizowano manifesty reklam. diff --git a/src/Cli/dotnet/commands/dotnet-workload/update/xlf/LocalizableStrings.pt-BR.xlf b/src/Cli/dotnet/commands/dotnet-workload/update/xlf/LocalizableStrings.pt-BR.xlf index 235954d94f87..75bda8b70c43 100644 --- a/src/Cli/dotnet/commands/dotnet-workload/update/xlf/LocalizableStrings.pt-BR.xlf +++ b/src/Cli/dotnet/commands/dotnet-workload/update/xlf/LocalizableStrings.pt-BR.xlf @@ -57,11 +57,6 @@ Falha ao baixar pacotes de atualização de carga de trabalho para o cache: {0} - - Invalid argument "{0}" to the --mode argument for dotnet workload update. Only supported modes are "workloadset", "loosemanifest", and "auto". - Argumento "{0}" inválido para o argumento --mode para atualização de carga de trabalho dotnet. Os únicos modos com suporte são "workloadset", "loosemanifest" e "auto". - - Successfully updated advertising manifests. Manifestos de anúncio atualizados com êxito. diff --git a/src/Cli/dotnet/commands/dotnet-workload/update/xlf/LocalizableStrings.ru.xlf b/src/Cli/dotnet/commands/dotnet-workload/update/xlf/LocalizableStrings.ru.xlf index b3b7e621533e..622ec9433961 100644 --- a/src/Cli/dotnet/commands/dotnet-workload/update/xlf/LocalizableStrings.ru.xlf +++ b/src/Cli/dotnet/commands/dotnet-workload/update/xlf/LocalizableStrings.ru.xlf @@ -57,11 +57,6 @@ Не удалось скачать пакеты обновления рабочей нагрузки в кэш: {0} - - Invalid argument "{0}" to the --mode argument for dotnet workload update. Only supported modes are "workloadset", "loosemanifest", and "auto". - Недопустимый аргумент "{0}" для аргумента --mode для обновления рабочей нагрузки dotnet. Поддерживаются только режимы "workloadset", "loosemanifest" и "auto". - - Successfully updated advertising manifests. Манифесты рекламы успешно обновлены. diff --git a/src/Cli/dotnet/commands/dotnet-workload/update/xlf/LocalizableStrings.tr.xlf b/src/Cli/dotnet/commands/dotnet-workload/update/xlf/LocalizableStrings.tr.xlf index 670f5d690df9..d72dbdf621a0 100644 --- a/src/Cli/dotnet/commands/dotnet-workload/update/xlf/LocalizableStrings.tr.xlf +++ b/src/Cli/dotnet/commands/dotnet-workload/update/xlf/LocalizableStrings.tr.xlf @@ -57,11 +57,6 @@ İş yükü güncelleştirme paketleri önbelleğe yüklenemedi: {0} - - Invalid argument "{0}" to the --mode argument for dotnet workload update. Only supported modes are "workloadset", "loosemanifest", and "auto". - Dotnet iş yükü güncelleştirmesi için --mod bağımsız değişkeninde geçersiz "{0}" bağımsız değişkeni. Yalnızca "workloadset", "loosemanifest" ve "auto" modları desteklenir. - - Successfully updated advertising manifests. Reklam bildirimleri başarıyla güncelleştirildi. diff --git a/src/Cli/dotnet/commands/dotnet-workload/update/xlf/LocalizableStrings.zh-Hans.xlf b/src/Cli/dotnet/commands/dotnet-workload/update/xlf/LocalizableStrings.zh-Hans.xlf index 3beaaebc1acf..135814c4fa3f 100644 --- a/src/Cli/dotnet/commands/dotnet-workload/update/xlf/LocalizableStrings.zh-Hans.xlf +++ b/src/Cli/dotnet/commands/dotnet-workload/update/xlf/LocalizableStrings.zh-Hans.xlf @@ -57,11 +57,6 @@ 未能将工作负载更新程序包下载到缓存: {0} - - Invalid argument "{0}" to the --mode argument for dotnet workload update. Only supported modes are "workloadset", "loosemanifest", and "auto". - dotnet 工作负载更新的 --mode 参数的参数“{0}”无效。仅支持“workloadset”、“loosemanifest”和“auto”模式。 - - Successfully updated advertising manifests. 成功更新广告清单。 diff --git a/src/Cli/dotnet/commands/dotnet-workload/update/xlf/LocalizableStrings.zh-Hant.xlf b/src/Cli/dotnet/commands/dotnet-workload/update/xlf/LocalizableStrings.zh-Hant.xlf index 914b6a666c8a..de4745663a4b 100644 --- a/src/Cli/dotnet/commands/dotnet-workload/update/xlf/LocalizableStrings.zh-Hant.xlf +++ b/src/Cli/dotnet/commands/dotnet-workload/update/xlf/LocalizableStrings.zh-Hant.xlf @@ -57,11 +57,6 @@ 無法將工作負載更新套件下載到快取: {0} - - Invalid argument "{0}" to the --mode argument for dotnet workload update. Only supported modes are "workloadset", "loosemanifest", and "auto". - dotnet 工作負載更新的 --mode 引數之引數 "{0}" 無效。僅支援 "workloadset"、"loosemanifest" 和 "auto" 模式。 - - Successfully updated advertising manifests. 已成功更新廣告資訊清單。 diff --git a/src/Cli/dotnet/dotnet.csproj b/src/Cli/dotnet/dotnet.csproj index de27955804a3..e2f8fe965719 100644 --- a/src/Cli/dotnet/dotnet.csproj +++ b/src/Cli/dotnet/dotnet.csproj @@ -74,6 +74,7 @@ + @@ -88,7 +89,7 @@ - + @@ -115,7 +116,7 @@ - + diff --git a/src/Resolvers/Microsoft.NET.Sdk.WorkloadManifestReader/SdkDirectoryWorkloadManifestProvider.cs b/src/Resolvers/Microsoft.NET.Sdk.WorkloadManifestReader/SdkDirectoryWorkloadManifestProvider.cs index eeefd7dee1c7..3ec592ccd955 100644 --- a/src/Resolvers/Microsoft.NET.Sdk.WorkloadManifestReader/SdkDirectoryWorkloadManifestProvider.cs +++ b/src/Resolvers/Microsoft.NET.Sdk.WorkloadManifestReader/SdkDirectoryWorkloadManifestProvider.cs @@ -159,11 +159,6 @@ public void RefreshWorkloadManifests() return _workloadSet?.Version!; } - if (InstallStateContents.FromPath(Path.Combine(WorkloadInstallType.GetInstallStateFolder(_sdkVersionBand, _sdkRootPath), "default.json")).UseWorkloadSets == true) - { - return null; - } - using (SHA256 sha256Hash = SHA256.Create()) { byte[] bytes = sha256Hash.ComputeHash(Encoding.UTF8.GetBytes(string.Join(";", diff --git a/src/Tests/dotnet-MsiInstallation.Tests/RemoteDirectory.cs b/src/Tests/dotnet-MsiInstallation.Tests/Framework/RemoteDirectory.cs similarity index 96% rename from src/Tests/dotnet-MsiInstallation.Tests/RemoteDirectory.cs rename to src/Tests/dotnet-MsiInstallation.Tests/Framework/RemoteDirectory.cs index 1c4762e1385e..f84cdbfc8867 100644 --- a/src/Tests/dotnet-MsiInstallation.Tests/RemoteDirectory.cs +++ b/src/Tests/dotnet-MsiInstallation.Tests/Framework/RemoteDirectory.cs @@ -8,7 +8,7 @@ using System.Threading.Tasks; using FluentAssertions.Execution; -namespace Microsoft.DotNet.MsiInstallerTests +namespace Microsoft.DotNet.MsiInstallerTests.Framework { abstract class RemoteDirectory { diff --git a/src/Tests/dotnet-MsiInstallation.Tests/RemoteFile.cs b/src/Tests/dotnet-MsiInstallation.Tests/Framework/RemoteFile.cs similarity index 96% rename from src/Tests/dotnet-MsiInstallation.Tests/RemoteFile.cs rename to src/Tests/dotnet-MsiInstallation.Tests/Framework/RemoteFile.cs index 0c09dd4f6657..fcdba5a6a00c 100644 --- a/src/Tests/dotnet-MsiInstallation.Tests/RemoteFile.cs +++ b/src/Tests/dotnet-MsiInstallation.Tests/Framework/RemoteFile.cs @@ -9,7 +9,7 @@ using System.Threading.Tasks; using FluentAssertions.Execution; -namespace Microsoft.DotNet.MsiInstallerTests +namespace Microsoft.DotNet.MsiInstallerTests.Framework { abstract class RemoteFile { diff --git a/src/Tests/dotnet-MsiInstallation.Tests/VMAction.cs b/src/Tests/dotnet-MsiInstallation.Tests/Framework/VMAction.cs similarity index 92% rename from src/Tests/dotnet-MsiInstallation.Tests/VMAction.cs rename to src/Tests/dotnet-MsiInstallation.Tests/Framework/VMAction.cs index a6591b1b7a53..9a7cb527cca7 100644 --- a/src/Tests/dotnet-MsiInstallation.Tests/VMAction.cs +++ b/src/Tests/dotnet-MsiInstallation.Tests/Framework/VMAction.cs @@ -10,7 +10,7 @@ using System.Threading.Tasks; using Microsoft.DotNet.Cli.Utils; -namespace Microsoft.DotNet.MsiInstallerTests +namespace Microsoft.DotNet.MsiInstallerTests.Framework { abstract class VMAction { @@ -124,6 +124,26 @@ protected override SerializedVMAction SerializeDerivedProperties() } } + class VMMoveFolderAction : VMAction + { + public string SourcePath { get; set; } + public string TargetPath { get; set; } + + public VMMoveFolderAction(VirtualMachine vm) : base(vm) + { + } + + protected override SerializedVMAction SerializeDerivedProperties() + { + return new SerializedVMAction + { + Type = VMActionType.MoveFolderOnVM, + SourcePath = SourcePath, + TargetPath = TargetPath, + }; + } + } + class VMWriteFileAction : VMAction { public string TargetPath { get; set; } @@ -168,6 +188,7 @@ enum VMActionType RunCommand, CopyFileToVM, CopyFolderToVM, + MoveFolderOnVM, WriteFileToVM, GetRemoteDirectory, GetRemoteFile, @@ -190,10 +211,10 @@ class SerializedVMAction // Applies to RunCommand public string WorkingDirectory { get; set; } - // Applies to CopyFileToVM, CopyFolderToVM, WriteFileToVM, GetRemoteDirectory, GetRemoteFile + // Applies to CopyFileToVM, CopyFolderToVM, MoveFolderOnVM, WriteFileToVM, GetRemoteDirectory, GetRemoteFile public string TargetPath { get; set; } - // Applies to CopyFileToVM, CopyFolderToVM + // Applies to CopyFileToVM, CopyFolderToVM, MoveFolderOnVM public string SourcePath { get; set; } // Applies to CopyFileToVM, CopyFolderToVM @@ -222,6 +243,8 @@ public string GetDescription() return $"Copy file to VM: {SourcePath} -> {TargetPath}"; case VMActionType.CopyFolderToVM: return $"Copy folder to VM: {SourcePath} -> {TargetPath}"; + case VMActionType.MoveFolderOnVM: + return $"Move folder {SourcePath} -> {TargetPath}"; case VMActionType.WriteFileToVM: return $"Write file to VM: {TargetPath}"; case VMActionType.GetRemoteDirectory: diff --git a/src/Tests/dotnet-MsiInstallation.Tests/VMControl.cs b/src/Tests/dotnet-MsiInstallation.Tests/Framework/VMControl.cs similarity index 95% rename from src/Tests/dotnet-MsiInstallation.Tests/VMControl.cs rename to src/Tests/dotnet-MsiInstallation.Tests/Framework/VMControl.cs index 07406fb2588f..b619124f24e8 100644 --- a/src/Tests/dotnet-MsiInstallation.Tests/VMControl.cs +++ b/src/Tests/dotnet-MsiInstallation.Tests/Framework/VMControl.cs @@ -6,7 +6,7 @@ using Microsoft.Management.Infrastructure; using Microsoft.Management.Infrastructure.Serialization; -namespace Microsoft.DotNet.MsiInstallerTests +namespace Microsoft.DotNet.MsiInstallerTests.Framework { internal class VMControl : IDisposable { @@ -73,7 +73,7 @@ public CommandResult RunCommandOnVM(string[] args, string workingDirectory = nul { var remoteCommand = new RemoteCommand(Log, VMMachineName, _psExecPath, workingDirectory, args); - for (int i=0; i<3; i++) + for (int i = 0; i < 3; i++) { var result = remoteCommand.Execute(); if (result.ExitCode != 6 && !result.StdErr.Contains("The handle is invalid")) @@ -204,7 +204,7 @@ public async Task SetRunningAsync(bool running) { VMEnabledState getCurrentState() { - var state = (VMEnabledState) (UInt16)VMInstance.CimInstanceProperties["EnabledState"].Value; + var state = (VMEnabledState)(ushort)VMInstance.CimInstanceProperties["EnabledState"].Value; return state; } @@ -219,7 +219,7 @@ VMEnabledState getCurrentState() var methodParameters = new CimMethodParametersCollection() { - CimMethodParameter.Create("RequestedState", (UInt16) targetState, CimFlags.In) + CimMethodParameter.Create("RequestedState", (ushort) targetState, CimFlags.In) }; @@ -245,13 +245,13 @@ private async Task WaitForJobSuccess(CimMethodResult result) { CimInstance job = (CimInstance)result.OutParameters["Job"].Value; job = _session.GetInstance(virtNamespace, job); - while (IsRunning((JobState)(UInt16)job.CimInstanceProperties["JobState"].Value)) + while (IsRunning((JobState)(ushort)job.CimInstanceProperties["JobState"].Value)) { await Task.Delay(100); job = _session.GetInstance(job.CimSystemProperties.Namespace, job); } - var jobState = (JobState)(UInt16)job.CimInstanceProperties["JobState"].Value; + var jobState = (JobState)(ushort)job.CimInstanceProperties["JobState"].Value; if (jobState != JobState.Completed && jobState != JobState.CompletedWithWarnings) { Log.WriteLine("Job failed: " + jobState); @@ -271,7 +271,7 @@ private async Task WaitForJobSuccess(CimMethodResult result) } else { - if (result.ReturnValue.Value is UInt32 returnValue) + if (result.ReturnValue.Value is uint returnValue) { if (returnValue != 0) { @@ -305,7 +305,7 @@ enum JobState CompletedWithWarnings = 32768 } - enum VMEnabledState : UInt16 + enum VMEnabledState : ushort { Unknown = 0, Other = 1, @@ -314,7 +314,7 @@ enum VMEnabledState : UInt16 ShuttingDown = 4, NotApplicable = 5, EnabledButOffline = 6, - + } class RemoteCommand : TestCommand diff --git a/src/Tests/dotnet-MsiInstallation.Tests/VMStateTree.cs b/src/Tests/dotnet-MsiInstallation.Tests/Framework/VMStateTree.cs similarity index 94% rename from src/Tests/dotnet-MsiInstallation.Tests/VMStateTree.cs rename to src/Tests/dotnet-MsiInstallation.Tests/Framework/VMStateTree.cs index 1c08293addff..aba8555d4e6c 100644 --- a/src/Tests/dotnet-MsiInstallation.Tests/VMStateTree.cs +++ b/src/Tests/dotnet-MsiInstallation.Tests/Framework/VMStateTree.cs @@ -1,11 +1,11 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -namespace Microsoft.DotNet.MsiInstallerTests +namespace Microsoft.DotNet.MsiInstallerTests.Framework { internal class VMStateTree { - public string SnapshotId { get; set; } + public string SnapshotId { get; set; } public string SnapshotName { get; set; } public Dictionary Actions { get; set; } = new(); @@ -18,7 +18,8 @@ public SerializableVMStateTree ToSerializeable() { SnapshotId = SnapshotId, SnapshotName = SnapshotName, - Actions = Actions.Select(a => new SerializableVMStateTree.Entry() { + Actions = Actions.Select(a => new SerializableVMStateTree.Entry() + { Action = a.Key, ActionResult = a.Value.actionResult, ResultingState = a.Value.resultingState.ToSerializeable() diff --git a/src/Tests/dotnet-MsiInstallation.Tests/Framework/VMTestBase.cs b/src/Tests/dotnet-MsiInstallation.Tests/Framework/VMTestBase.cs new file mode 100644 index 000000000000..89b3a2054617 --- /dev/null +++ b/src/Tests/dotnet-MsiInstallation.Tests/Framework/VMTestBase.cs @@ -0,0 +1,150 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using Microsoft.NET.Sdk.WorkloadManifestReader; + +namespace Microsoft.DotNet.MsiInstallerTests.Framework +{ + public class VMTestBase : SdkTest, IDisposable + { + internal VirtualMachine VM { get; } + + public VMTestBase(ITestOutputHelper log) : base(log) + { + VM = new VirtualMachine(Log); + } + + public virtual void Dispose() + { + VM.Dispose(); + } + + protected string SdkInstallerVersion + { + get + { + if (!string.IsNullOrEmpty(VM.VMTestSettings.SdkInstallerVersion)) + { + return VM.VMTestSettings.SdkInstallerVersion; + } + else + { + return "8.0.203"; + } + } + } + + protected string SdkInstallerFileName => $"dotnet-sdk-{SdkInstallerVersion}-win-x64.exe"; + + protected void InstallSdk(bool deployStage2 = true) + { + VM.CreateRunCommand("setx", "DOTNET_NOLOGO", "true") + .WithDescription("Disable .NET SDK first run message") + .Execute() + .Should() + .Pass(); + + VM.CreateRunCommand($@"c:\SdkTesting\{SdkInstallerFileName}", "/quiet") + .WithDescription($"Install SDK {SdkInstallerVersion}") + .Execute() + .Should() + .Pass(); + + if (deployStage2) + { + DeployStage2Sdk(); + } + } + + protected void UninstallSdk() + { + VM.CreateRunCommand($@"c:\SdkTesting\{SdkInstallerFileName}", "/quiet", "/uninstall") + .WithDescription($"Uninstall SDK {SdkInstallerVersion}") + .Execute() + .Should() + .Pass(); + } + + protected void DeployStage2Sdk() + { + if (!VM.VMTestSettings.ShouldTestStage2) + { + return; + } + + var installedSdkFolder = $@"c:\Program Files\dotnet\sdk\{SdkInstallerVersion}"; + + Log.WriteLine($"Deploying SDK from {TestContext.Current.ToolsetUnderTest.SdkFolderUnderTest} to {installedSdkFolder} on VM."); + + // TODO: It would be nice if the description included the date/time of the SDK build, to distinguish different snapshots + VM.CreateActionGroup("Deploy Stage 2 SDK", + VM.CopyFolder(TestContext.Current.ToolsetUnderTest.SdkFolderUnderTest, installedSdkFolder), + ChangeVersionFileContents(SdkInstallerVersion)) + .Execute() + .Should() + .Pass(); + } + + protected void ChangeSdkVersion(string oldVersion, string newVersion) + { + var oldSdkFolder = $@"c:\Program Files\dotnet\sdk\{oldVersion}"; + var newSdkFolder = $@"c:\Program Files\dotnet\sdk\{newVersion}"; + + new VMMoveFolderAction(VM) + { + SourcePath = oldSdkFolder, + TargetPath = newSdkFolder + } + .WithDescription($"Change SDK version to {newVersion}") + .Execute().Should().Pass(); + + ChangeVersionFileContents(newVersion) + .WithDescription("Update .version file") + .Execute() + .Should() + .Pass(); + + } + + private VMWriteFileAction ChangeVersionFileContents(string sdkVersion) + { + var installedSdkFolder = $@"c:\Program Files\dotnet\sdk\{sdkVersion}"; + var vmVersionFilePath = Path.Combine(installedSdkFolder, ".version"); + + var newVersionFileContents = File.ReadAllLines(Path.Combine(TestContext.Current.ToolsetUnderTest.SdkFolderUnderTest, ".version")); + newVersionFileContents[1] = sdkVersion; + + return VM.WriteFile(vmVersionFilePath, string.Join(Environment.NewLine, newVersionFileContents)); + + } + + protected string GetInstalledSdkVersion() + { + var command = VM.CreateRunCommand("dotnet", "--version"); + command.IsReadOnly = true; + var result = command.Execute(); + result.Should().Pass(); + return result.StdOut; + } + + protected WorkloadSet GetRollback() + { + var result = VM.CreateRunCommand("dotnet", "workload", "update", "--print-rollback") + .WithIsReadOnly(true) + .Execute(); + + result.Should().Pass(); + + return ParseRollbackOutput(result.StdOut); + } + + protected WorkloadSet ParseRollbackOutput(string output) + { + var filteredOutput = string.Join(Environment.NewLine, + output.Split(Environment.NewLine) + .Except(["==workloadRollbackDefinitionJsonOutputStart==", "==workloadRollbackDefinitionJsonOutputEnd=="])); + + return WorkloadSet.FromJson(filteredOutput, defaultFeatureBand: new SdkFeatureBand(SdkInstallerVersion)); + } + } +} diff --git a/src/Tests/dotnet-MsiInstallation.Tests/VMTestSettings.cs b/src/Tests/dotnet-MsiInstallation.Tests/Framework/VMTestSettings.cs similarity index 90% rename from src/Tests/dotnet-MsiInstallation.Tests/VMTestSettings.cs rename to src/Tests/dotnet-MsiInstallation.Tests/Framework/VMTestSettings.cs index 22fbdf22e83d..82670bfd72e2 100644 --- a/src/Tests/dotnet-MsiInstallation.Tests/VMTestSettings.cs +++ b/src/Tests/dotnet-MsiInstallation.Tests/Framework/VMTestSettings.cs @@ -7,7 +7,7 @@ using System.Text; using System.Threading.Tasks; -namespace Microsoft.DotNet.MsiInstallerTests +namespace Microsoft.DotNet.MsiInstallerTests.Framework { internal class VMTestSettings { diff --git a/src/Tests/dotnet-MsiInstallation.Tests/VirtualMachine.cs b/src/Tests/dotnet-MsiInstallation.Tests/Framework/VirtualMachine.cs similarity index 97% rename from src/Tests/dotnet-MsiInstallation.Tests/VirtualMachine.cs rename to src/Tests/dotnet-MsiInstallation.Tests/Framework/VirtualMachine.cs index 8ebeda0d4ec4..ac2496bf64a9 100644 --- a/src/Tests/dotnet-MsiInstallation.Tests/VirtualMachine.cs +++ b/src/Tests/dotnet-MsiInstallation.Tests/Framework/VirtualMachine.cs @@ -4,7 +4,7 @@ using System.Text.Json; using System.Text.Json.Serialization; -namespace Microsoft.DotNet.MsiInstallerTests +namespace Microsoft.DotNet.MsiInstallerTests.Framework { class VirtualMachine : IDisposable { @@ -130,7 +130,7 @@ void Recurse(VMStateTree node) Log.WriteLine($"Removing missing snapshot from tree: {nodeToRemove.Value.resultingState.SnapshotName}"); node.Actions.Remove(nodeToRemove.Key); } - + foreach (var result in node.Actions.Select(a => a.Value.resultingState)) { Recurse(result); @@ -211,7 +211,7 @@ void LogActionResult(SerializedVMAction action, VMActionResult result) } else if (action.Type == VMActionType.ActionGroup && result.GroupedResults != null) { - for (int i=0; i $"dotnet-sdk-{SdkInstallerVersion}-win-x64.exe"; - const string RollbackRC1 = """ { "microsoft.net.sdk.android": "34.0.0-rc.1.432/8.0.100-rc.1", @@ -61,45 +44,8 @@ string SdkInstallerVersion } """; - VirtualMachine VM { get; } - public WorkloadTests(ITestOutputHelper log) : base(log) { - VM = new VirtualMachine(Log); - } - - public void Dispose() - { - VM.Dispose(); - } - - void InstallSdk(bool deployStage2 = true) - { - VM.CreateRunCommand("setx", "DOTNET_NOLOGO", "true") - .WithDescription("Disable .NET SDK first run message") - .Execute() - .Should() - .Pass(); - - VM.CreateRunCommand($@"c:\SdkTesting\{SdkInstallerFileName}", "/quiet") - .WithDescription($"Install SDK {SdkInstallerVersion}") - .Execute() - .Should() - .Pass(); - - if (deployStage2) - { - DeployStage2Sdk(); - } - } - - void UninstallSdk() - { - VM.CreateRunCommand($@"c:\SdkTesting\{SdkInstallerFileName}", "/quiet", "/uninstall") - .WithDescription($"Uninstall SDK {SdkInstallerVersion}") - .Execute() - .Should() - .Pass(); } private CommandResult ApplyManifests(string manifestContents, string rollbackID) @@ -286,14 +232,6 @@ public void ApplyRollbackShouldNotUpdateAdvertisingManifests() throw new NotImplementedException(); } - string GetInstalledSdkVersion() - { - var command = VM.CreateRunCommand("dotnet", "--version"); - command.IsReadOnly = true; - var result = command.Execute(); - result.Should().Pass(); - return result.StdOut; - } void TestWasmWorkload() { @@ -372,31 +310,7 @@ void CheckForDuplicateManifests() return installedManifestVersions; } - void DeployStage2Sdk() - { - if (!VM.VMTestSettings.ShouldTestStage2) - { - return; - } - - var installedSdkFolder = $@"c:\Program Files\dotnet\sdk\{SdkInstallerVersion}"; - Log.WriteLine($"Deploying SDK from {TestContext.Current.ToolsetUnderTest.SdkFolderUnderTest} to {installedSdkFolder} on VM."); - - var vmVersionFilePath = Path.Combine(installedSdkFolder, ".version"); - - var existingVersionFileContents = VM.GetRemoteFile(vmVersionFilePath).ReadAllText().Split(Environment.NewLine); - var newVersionFileContents = File.ReadAllLines(Path.Combine(TestContext.Current.ToolsetUnderTest.SdkFolderUnderTest, ".version")); - newVersionFileContents[1] = existingVersionFileContents[1]; - - // TODO: It would be nice if the description included the date/time of the SDK build, to distinguish different snapshots - VM.CreateActionGroup("Deploy Stage 2 SDK", - VM.CopyFolder(TestContext.Current.ToolsetUnderTest.SdkFolderUnderTest, installedSdkFolder), - VM.WriteFile(vmVersionFilePath, string.Join(Environment.NewLine, newVersionFileContents))) - .Execute() - .Should() - .Pass(); - } CommandResult InstallWorkload(string workloadName) { @@ -419,25 +333,5 @@ string ListWorkloads() return result.StdOut; } - - WorkloadSet GetRollback() - { - var result = VM.CreateRunCommand("dotnet", "workload", "update", "--print-rollback") - .WithIsReadOnly(true) - .Execute(); - - result.Should().Pass(); - - return ParseRollbackOutput(result.StdOut); - } - - WorkloadSet ParseRollbackOutput(string output) - { - var filteredOutput = string.Join(Environment.NewLine, - output.Split(Environment.NewLine) - .Except(["==workloadRollbackDefinitionJsonOutputStart==", "==workloadRollbackDefinitionJsonOutputEnd=="])); - - return WorkloadSet.FromJson(filteredOutput, defaultFeatureBand: new SdkFeatureBand(SdkInstallerVersion)); - } } } diff --git a/src/Tests/dotnet-MsiInstallation.Tests/WorkloadSetTests.cs b/src/Tests/dotnet-MsiInstallation.Tests/WorkloadSetTests.cs new file mode 100644 index 000000000000..2718d39cedc1 --- /dev/null +++ b/src/Tests/dotnet-MsiInstallation.Tests/WorkloadSetTests.cs @@ -0,0 +1,143 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Microsoft.DotNet.MsiInstallerTests.Framework; +using Microsoft.NET.Sdk.WorkloadManifestReader; + +namespace Microsoft.DotNet.MsiInstallerTests +{ + public class WorkloadSetTests : VMTestBase + { + public WorkloadSetTests(ITestOutputHelper log) : base(log) + { + } + + [Fact] + public void DoesNotUseWorkloadSetsByDefault() + { + InstallSdk(); + + VM.CreateRunCommand("dotnet", "workload", "update") + .Execute() + .Should() + .Pass(); + + var originalRollback = GetRollback(); + + VM.CreateRunCommand("dotnet", "nuget", "add", "source", @"c:\SdkTesting\WorkloadSets") + .WithDescription("Add WorkloadSets to NuGet.config") + .Execute() + .Should() + .Pass(); + + VM.CreateRunCommand("dotnet", "workload", "update") + .Execute() + .Should() + .Pass(); + + var newRollback = GetRollback(); + + newRollback.ManifestVersions.Should().BeEquivalentTo(originalRollback.ManifestVersions); + + } + + void UpdateAndSwitchToWorkloadSetMode(out string updatedWorkloadVersion, out WorkloadSet rollbackAfterUpdate) + { + var originalWorkloadVersion = GetWorkloadVersion(); + originalWorkloadVersion.Should().StartWith("8.0.200-manifests."); + + VM.CreateRunCommand("dotnet", "workload", "update") + .Execute() + .Should() + .Pass(); + + rollbackAfterUpdate = GetRollback(); + updatedWorkloadVersion = GetWorkloadVersion(); + updatedWorkloadVersion.Should().StartWith("8.0.200-manifests."); + updatedWorkloadVersion.Should().NotBe(originalWorkloadVersion); + + GetUpdateMode().Should().Be("manifests"); + + VM.CreateRunCommand("dotnet", "workload", "config", "--update-mode", "workload-set") + .WithDescription("Switch mode to workload-set") + .Execute() + .Should() + .Pass(); + + GetWorkloadVersion().Should().Be(updatedWorkloadVersion); + + GetUpdateMode().Should().Be("workload-set"); + } + + [Fact] + public void UpdateWithWorkloadSets() + { + InstallSdk(); + + UpdateAndSwitchToWorkloadSetMode(out string _, out WorkloadSet rollbackAfterUpdate); + + VM.CreateRunCommand("dotnet", "nuget", "add", "source", @"c:\SdkTesting\WorkloadSets") + .WithDescription("Add WorkloadSets to NuGet.config") + .Execute() + .Should() + .Pass(); + + VM.CreateRunCommand("dotnet", "workload", "update") + .Execute() + .Should() + .Pass(); + + var newRollback = GetRollback(); + + newRollback.ManifestVersions.Should().NotBeEquivalentTo(rollbackAfterUpdate.ManifestVersions); + + GetWorkloadVersion().Should().Be("8.0.201"); + } + + [Fact] + public void UpdateInWorkloadSetModeWithNoAvailableWorkloadSet() + { + InstallSdk(); + + UpdateAndSwitchToWorkloadSetMode(out string updatedWorkloadVersion, out WorkloadSet rollbackAfterUpdate); + + VM.CreateRunCommand("dotnet", "workload", "update") + .Execute() + .Should() + .Pass(); + + var newRollback = GetRollback(); + + newRollback.ManifestVersions.Should().BeEquivalentTo(rollbackAfterUpdate.ManifestVersions); + + GetWorkloadVersion().Should().Be(updatedWorkloadVersion); + } + + string GetWorkloadVersion() + { + var result = VM.CreateRunCommand("dotnet", "workload", "--version") + .WithIsReadOnly(true) + .Execute(); + + result.Should().Pass(); + + return result.StdOut; + } + + string GetUpdateMode() + { + var result = VM.CreateRunCommand("dotnet", "workload", "config", "--update-mode") + .WithIsReadOnly(true) + .Execute(); + + result.Should().Pass(); + + return result.StdOut; + } + } +}