From 90cd2f5e826b2c394005c76e69f4f7b0a8b7345e Mon Sep 17 00:00:00 2001 From: Daniel Plaisted Date: Mon, 18 Mar 2024 17:34:29 -0400 Subject: [PATCH 1/9] Show workload version even if no workload set is installed --- .../SdkDirectoryWorkloadManifestProvider.cs | 5 ----- 1 file changed, 5 deletions(-) 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(";", From ae688137f9a8db206b2fc1f2b68d3a9dca66cbf1 Mon Sep 17 00:00:00 2001 From: Daniel Plaisted Date: Mon, 18 Mar 2024 17:35:35 -0400 Subject: [PATCH 2/9] Move VM testing framework to subfolder --- .../{ => Framework}/RemoteDirectory.cs | 2 +- .../{ => Framework}/RemoteFile.cs | 2 +- .../{ => Framework}/VMAction.cs | 2 +- .../{ => Framework}/VMControl.cs | 18 +-- .../{ => Framework}/VMStateTree.cs | 7 +- .../Framework/VMTestBase.cs | 123 ++++++++++++++++++ .../{ => Framework}/VMTestSettings.cs | 2 +- .../{ => Framework}/VirtualMachine.cs | 6 +- .../MsiInstallerTests.cs | 110 +--------------- 9 files changed, 145 insertions(+), 127 deletions(-) rename src/Tests/dotnet-MsiInstallation.Tests/{ => Framework}/RemoteDirectory.cs (96%) rename src/Tests/dotnet-MsiInstallation.Tests/{ => Framework}/RemoteFile.cs (96%) rename src/Tests/dotnet-MsiInstallation.Tests/{ => Framework}/VMAction.cs (99%) rename src/Tests/dotnet-MsiInstallation.Tests/{ => Framework}/VMControl.cs (95%) rename src/Tests/dotnet-MsiInstallation.Tests/{ => Framework}/VMStateTree.cs (94%) create mode 100644 src/Tests/dotnet-MsiInstallation.Tests/Framework/VMTestBase.cs rename src/Tests/dotnet-MsiInstallation.Tests/{ => Framework}/VMTestSettings.cs (90%) rename src/Tests/dotnet-MsiInstallation.Tests/{ => Framework}/VirtualMachine.cs (99%) 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 99% rename from src/Tests/dotnet-MsiInstallation.Tests/VMAction.cs rename to src/Tests/dotnet-MsiInstallation.Tests/Framework/VMAction.cs index a6591b1b7a53..34ca1f806ebf 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 { 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..ea73e4c54f41 --- /dev/null +++ b/src/Tests/dotnet-MsiInstallation.Tests/Framework/VMTestBase.cs @@ -0,0 +1,123 @@ +// 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."); + + 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(); + } + + 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 99% rename from src/Tests/dotnet-MsiInstallation.Tests/VirtualMachine.cs rename to src/Tests/dotnet-MsiInstallation.Tests/Framework/VirtualMachine.cs index 8ebeda0d4ec4..b075df512e4a 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)); - } } } From 56efa35499a8e58d977a7cadc439dab56188834e Mon Sep 17 00:00:00 2001 From: Daniel Plaisted Date: Tue, 19 Mar 2024 12:43:37 -0400 Subject: [PATCH 3/9] Add workload config command --- .../dotnet-workload/WorkloadCommandParser.cs | 1 + .../config/LocalizableStrings.resx | 123 ++++++++++++++++++ .../config/WorkloadConfigCommand.cs | 96 ++++++++++++++ .../config/WorkloadConfigCommandParser.cs | 45 +++++++ .../config/xlf/LocalizableStrings.cs.xlf | 12 ++ .../config/xlf/LocalizableStrings.de.xlf | 12 ++ .../config/xlf/LocalizableStrings.es.xlf | 12 ++ .../config/xlf/LocalizableStrings.fr.xlf | 12 ++ .../config/xlf/LocalizableStrings.it.xlf | 12 ++ .../config/xlf/LocalizableStrings.ja.xlf | 12 ++ .../config/xlf/LocalizableStrings.ko.xlf | 12 ++ .../config/xlf/LocalizableStrings.pl.xlf | 12 ++ .../config/xlf/LocalizableStrings.pt-BR.xlf | 12 ++ .../config/xlf/LocalizableStrings.ru.xlf | 12 ++ .../config/xlf/LocalizableStrings.tr.xlf | 12 ++ .../config/xlf/LocalizableStrings.zh-Hans.xlf | 12 ++ .../config/xlf/LocalizableStrings.zh-Hant.xlf | 12 ++ src/Cli/dotnet/dotnet.csproj | 5 +- 18 files changed, 424 insertions(+), 2 deletions(-) create mode 100644 src/Cli/dotnet/commands/dotnet-workload/config/LocalizableStrings.resx create mode 100644 src/Cli/dotnet/commands/dotnet-workload/config/WorkloadConfigCommand.cs create mode 100644 src/Cli/dotnet/commands/dotnet-workload/config/WorkloadConfigCommandParser.cs create mode 100644 src/Cli/dotnet/commands/dotnet-workload/config/xlf/LocalizableStrings.cs.xlf create mode 100644 src/Cli/dotnet/commands/dotnet-workload/config/xlf/LocalizableStrings.de.xlf create mode 100644 src/Cli/dotnet/commands/dotnet-workload/config/xlf/LocalizableStrings.es.xlf create mode 100644 src/Cli/dotnet/commands/dotnet-workload/config/xlf/LocalizableStrings.fr.xlf create mode 100644 src/Cli/dotnet/commands/dotnet-workload/config/xlf/LocalizableStrings.it.xlf create mode 100644 src/Cli/dotnet/commands/dotnet-workload/config/xlf/LocalizableStrings.ja.xlf create mode 100644 src/Cli/dotnet/commands/dotnet-workload/config/xlf/LocalizableStrings.ko.xlf create mode 100644 src/Cli/dotnet/commands/dotnet-workload/config/xlf/LocalizableStrings.pl.xlf create mode 100644 src/Cli/dotnet/commands/dotnet-workload/config/xlf/LocalizableStrings.pt-BR.xlf create mode 100644 src/Cli/dotnet/commands/dotnet-workload/config/xlf/LocalizableStrings.ru.xlf create mode 100644 src/Cli/dotnet/commands/dotnet-workload/config/xlf/LocalizableStrings.tr.xlf create mode 100644 src/Cli/dotnet/commands/dotnet-workload/config/xlf/LocalizableStrings.zh-Hans.xlf create mode 100644 src/Cli/dotnet/commands/dotnet-workload/config/xlf/LocalizableStrings.zh-Hant.xlf 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..f3f1deee1532 --- /dev/null +++ b/src/Cli/dotnet/commands/dotnet-workload/config/LocalizableStrings.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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. + + 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..003242b5073c --- /dev/null +++ b/src/Cli/dotnet/commands/dotnet-workload/config/WorkloadConfigCommand.cs @@ -0,0 +1,96 @@ +// 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 + { + bool _hasUpdateMode; + string? _updateMode; + 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) + { + // TODO: Is it possible to check the order of the options? This would allow us to print the values out in the same order they are specified on the command line + _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() + { + if (_hasUpdateMode) + { + if (_updateMode == WorkloadConfigCommandParser.UpdateMode_WorkloadSet) + { + _workloadInstaller.UpdateInstallMode(_sdkFeatureBand, true); + } + else if (_updateMode == WorkloadConfigCommandParser.UpdateMode_Manifests) + { + _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 + { + Reporter.WriteLine($"Invalid update mode: {_updateMode}"); + return 1; + } + } + else + { + Reporter.WriteLine("No update mode specified"); + } + + 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..af4ef1cd0038 --- /dev/null +++ b/src/Cli/dotnet/commands/dotnet-workload/config/WorkloadConfigCommandParser.cs @@ -0,0 +1,45 @@ +// 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 = "Set the update mode for the workload manifest", + //Hidden = true, + 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..b791dc2c462c --- /dev/null +++ b/src/Cli/dotnet/commands/dotnet-workload/config/xlf/LocalizableStrings.cs.xlf @@ -0,0 +1,12 @@ + + + + + + Modify or display workload configuration values. + Modify or display workload configuration values. + + + + + \ 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..2df8dd41fb44 --- /dev/null +++ b/src/Cli/dotnet/commands/dotnet-workload/config/xlf/LocalizableStrings.de.xlf @@ -0,0 +1,12 @@ + + + + + + Modify or display workload configuration values. + Modify or display workload configuration values. + + + + + \ 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..6fa38eb732a9 --- /dev/null +++ b/src/Cli/dotnet/commands/dotnet-workload/config/xlf/LocalizableStrings.es.xlf @@ -0,0 +1,12 @@ + + + + + + Modify or display workload configuration values. + Modify or display workload configuration values. + + + + + \ 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..628665bd2a50 --- /dev/null +++ b/src/Cli/dotnet/commands/dotnet-workload/config/xlf/LocalizableStrings.fr.xlf @@ -0,0 +1,12 @@ + + + + + + Modify or display workload configuration values. + Modify or display workload configuration values. + + + + + \ 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..8e2cf902ddda --- /dev/null +++ b/src/Cli/dotnet/commands/dotnet-workload/config/xlf/LocalizableStrings.it.xlf @@ -0,0 +1,12 @@ + + + + + + Modify or display workload configuration values. + Modify or display workload configuration values. + + + + + \ 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..e7f3662d459f --- /dev/null +++ b/src/Cli/dotnet/commands/dotnet-workload/config/xlf/LocalizableStrings.ja.xlf @@ -0,0 +1,12 @@ + + + + + + Modify or display workload configuration values. + Modify or display workload configuration values. + + + + + \ 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..fe593ef40e37 --- /dev/null +++ b/src/Cli/dotnet/commands/dotnet-workload/config/xlf/LocalizableStrings.ko.xlf @@ -0,0 +1,12 @@ + + + + + + Modify or display workload configuration values. + Modify or display workload configuration values. + + + + + \ 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..58f4dc222a50 --- /dev/null +++ b/src/Cli/dotnet/commands/dotnet-workload/config/xlf/LocalizableStrings.pl.xlf @@ -0,0 +1,12 @@ + + + + + + Modify or display workload configuration values. + Modify or display workload configuration values. + + + + + \ 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..3100530fcd84 --- /dev/null +++ b/src/Cli/dotnet/commands/dotnet-workload/config/xlf/LocalizableStrings.pt-BR.xlf @@ -0,0 +1,12 @@ + + + + + + Modify or display workload configuration values. + Modify or display workload configuration values. + + + + + \ 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..15a9601c79e1 --- /dev/null +++ b/src/Cli/dotnet/commands/dotnet-workload/config/xlf/LocalizableStrings.ru.xlf @@ -0,0 +1,12 @@ + + + + + + Modify or display workload configuration values. + Modify or display workload configuration values. + + + + + \ 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..0e8ae5ca53ec --- /dev/null +++ b/src/Cli/dotnet/commands/dotnet-workload/config/xlf/LocalizableStrings.tr.xlf @@ -0,0 +1,12 @@ + + + + + + Modify or display workload configuration values. + Modify or display workload configuration values. + + + + + \ 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..886acc5bc439 --- /dev/null +++ b/src/Cli/dotnet/commands/dotnet-workload/config/xlf/LocalizableStrings.zh-Hans.xlf @@ -0,0 +1,12 @@ + + + + + + Modify or display workload configuration values. + Modify or display workload configuration values. + + + + + \ 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..ad00159d81f4 --- /dev/null +++ b/src/Cli/dotnet/commands/dotnet-workload/config/xlf/LocalizableStrings.zh-Hant.xlf @@ -0,0 +1,12 @@ + + + + + + Modify or display workload configuration values. + Modify or display workload configuration values. + + + + + \ No newline at end of file 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 @@ - + From 321b6d460cd62809d8cbc7a0a88599bb7bf7f55e Mon Sep 17 00:00:00 2001 From: Daniel Plaisted Date: Tue, 19 Mar 2024 12:43:53 -0400 Subject: [PATCH 4/9] Add initial workload set tests --- .../WorkloadSetTests.cs | 139 ++++++++++++++++++ 1 file changed, 139 insertions(+) create mode 100644 src/Tests/dotnet-MsiInstallation.Tests/WorkloadSetTests.cs diff --git a/src/Tests/dotnet-MsiInstallation.Tests/WorkloadSetTests.cs b/src/Tests/dotnet-MsiInstallation.Tests/WorkloadSetTests.cs new file mode 100644 index 000000000000..994ba0160c49 --- /dev/null +++ b/src/Tests/dotnet-MsiInstallation.Tests/WorkloadSetTests.cs @@ -0,0 +1,139 @@ +// 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; + +namespace Microsoft.DotNet.MsiInstallerTests +{ + public class WorkloadSetTests : VMTestBase + { + public WorkloadSetTests(ITestOutputHelper log) : base(log) + { + } + + // dotnet nuget add source c:\SdkTesting\WorkloadSets + // dotnet workload update --mode workloadset + + // Show workload mode in dotnet workload --info + + + // dotnet workload update-mode set workload-set + + // dotnet workload config --update-mode workload-set + + // dotnet workload config update-mode + // dotnet workload config update-mode workload-set + // dotnet workload config update-mode manifests + + // dotnet workload config update-band [default|release|preview|daily] + + // dotnet config workload.update-mode workload-set + + // dotnet setconfig --workload-update-mode workload-set + + [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); + + } + + [Fact] + public void UpdateWithWorkloadSets() + { + InstallSdk(); + + var originalWorkloadVersion = GetWorkloadVersion(); + originalWorkloadVersion.Should().StartWith("8.0.200-manifests."); + + VM.CreateRunCommand("dotnet", "workload", "update") + .Execute() + .Should() + .Pass(); + + var originalRollback = GetRollback(); + var updatedWorkloadVersion = GetWorkloadVersion(); + updatedWorkloadVersion.Should().StartWith("8.0.200-manifests."); + updatedWorkloadVersion.Should().NotBe(originalWorkloadVersion); + + VM.CreateRunCommand("dotnet", "nuget", "add", "source", @"c:\SdkTesting\WorkloadSets") + .WithDescription("Add WorkloadSets to NuGet.config") + .Execute() + .Should() + .Pass(); + + 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"); + + VM.CreateRunCommand("dotnet", "workload", "update") + .Execute() + .Should() + .Pass(); + + var newRollback = GetRollback(); + + newRollback.ManifestVersions.Should().NotBeEquivalentTo(originalRollback.ManifestVersions); + + GetWorkloadVersion().Should().Be("8.0.201"); + + } + + 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; + } + } +} From bcc7037cc2569e50a6e1f5defe0315ec999312d1 Mon Sep 17 00:00:00 2001 From: Daniel Plaisted Date: Wed, 20 Mar 2024 07:39:04 -0400 Subject: [PATCH 5/9] Updates to workload config command --- .../dotnet-workload/config/LocalizableStrings.resx | 6 +++++- .../dotnet-workload/config/WorkloadConfigCommand.cs | 6 +++--- .../config/WorkloadConfigCommandParser.cs | 2 +- .../config/xlf/LocalizableStrings.cs.xlf | 11 +++++++++-- .../config/xlf/LocalizableStrings.de.xlf | 11 +++++++++-- .../config/xlf/LocalizableStrings.es.xlf | 11 +++++++++-- .../config/xlf/LocalizableStrings.fr.xlf | 11 +++++++++-- .../config/xlf/LocalizableStrings.it.xlf | 11 +++++++++-- .../config/xlf/LocalizableStrings.ja.xlf | 11 +++++++++-- .../config/xlf/LocalizableStrings.ko.xlf | 11 +++++++++-- .../config/xlf/LocalizableStrings.pl.xlf | 11 +++++++++-- .../config/xlf/LocalizableStrings.pt-BR.xlf | 11 +++++++++-- .../config/xlf/LocalizableStrings.ru.xlf | 11 +++++++++-- .../config/xlf/LocalizableStrings.tr.xlf | 11 +++++++++-- .../config/xlf/LocalizableStrings.zh-Hans.xlf | 11 +++++++++-- .../config/xlf/LocalizableStrings.zh-Hant.xlf | 11 +++++++++-- 16 files changed, 126 insertions(+), 31 deletions(-) diff --git a/src/Cli/dotnet/commands/dotnet-workload/config/LocalizableStrings.resx b/src/Cli/dotnet/commands/dotnet-workload/config/LocalizableStrings.resx index f3f1deee1532..4e1d34189dd2 100644 --- a/src/Cli/dotnet/commands/dotnet-workload/config/LocalizableStrings.resx +++ b/src/Cli/dotnet/commands/dotnet-workload/config/LocalizableStrings.resx @@ -118,6 +118,10 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - Modify or display workload configuration values. + 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 index 003242b5073c..0329b3770bca 100644 --- a/src/Cli/dotnet/commands/dotnet-workload/config/WorkloadConfigCommand.cs +++ b/src/Cli/dotnet/commands/dotnet-workload/config/WorkloadConfigCommand.cs @@ -80,13 +80,13 @@ public override int Execute() } else { - Reporter.WriteLine($"Invalid update mode: {_updateMode}"); - return 1; + // 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 { - Reporter.WriteLine("No update mode specified"); + _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 index af4ef1cd0038..ee1a96ba73a5 100644 --- a/src/Cli/dotnet/commands/dotnet-workload/config/WorkloadConfigCommandParser.cs +++ b/src/Cli/dotnet/commands/dotnet-workload/config/WorkloadConfigCommandParser.cs @@ -15,7 +15,7 @@ internal static class WorkloadConfigCommandParser public static readonly CliOption UpdateMode = new("--update-mode") { - Description = "Set the update mode for the workload manifest", + Description = LocalizableStrings.UpdateModeDescription, //Hidden = true, Arity = ArgumentArity.ZeroOrOne }; 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 index b791dc2c462c..8d6be7eaaf81 100644 --- a/src/Cli/dotnet/commands/dotnet-workload/config/xlf/LocalizableStrings.cs.xlf +++ b/src/Cli/dotnet/commands/dotnet-workload/config/xlf/LocalizableStrings.cs.xlf @@ -3,8 +3,15 @@ - Modify or display workload configuration values. - Modify or display workload configuration values. + 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. 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 index 2df8dd41fb44..88aee0f67512 100644 --- a/src/Cli/dotnet/commands/dotnet-workload/config/xlf/LocalizableStrings.de.xlf +++ b/src/Cli/dotnet/commands/dotnet-workload/config/xlf/LocalizableStrings.de.xlf @@ -3,8 +3,15 @@ - Modify or display workload configuration values. - Modify or display workload configuration values. + 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. 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 index 6fa38eb732a9..55b10d407fc2 100644 --- a/src/Cli/dotnet/commands/dotnet-workload/config/xlf/LocalizableStrings.es.xlf +++ b/src/Cli/dotnet/commands/dotnet-workload/config/xlf/LocalizableStrings.es.xlf @@ -3,8 +3,15 @@ - Modify or display workload configuration values. - Modify or display workload configuration values. + 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. 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 index 628665bd2a50..c7cc788430d4 100644 --- a/src/Cli/dotnet/commands/dotnet-workload/config/xlf/LocalizableStrings.fr.xlf +++ b/src/Cli/dotnet/commands/dotnet-workload/config/xlf/LocalizableStrings.fr.xlf @@ -3,8 +3,15 @@ - Modify or display workload configuration values. - Modify or display workload configuration values. + 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. 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 index 8e2cf902ddda..ba98130db0bf 100644 --- a/src/Cli/dotnet/commands/dotnet-workload/config/xlf/LocalizableStrings.it.xlf +++ b/src/Cli/dotnet/commands/dotnet-workload/config/xlf/LocalizableStrings.it.xlf @@ -3,8 +3,15 @@ - Modify or display workload configuration values. - Modify or display workload configuration values. + 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. 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 index e7f3662d459f..882fdf49f5d9 100644 --- a/src/Cli/dotnet/commands/dotnet-workload/config/xlf/LocalizableStrings.ja.xlf +++ b/src/Cli/dotnet/commands/dotnet-workload/config/xlf/LocalizableStrings.ja.xlf @@ -3,8 +3,15 @@ - Modify or display workload configuration values. - Modify or display workload configuration values. + 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. 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 index fe593ef40e37..b8773e9b116c 100644 --- a/src/Cli/dotnet/commands/dotnet-workload/config/xlf/LocalizableStrings.ko.xlf +++ b/src/Cli/dotnet/commands/dotnet-workload/config/xlf/LocalizableStrings.ko.xlf @@ -3,8 +3,15 @@ - Modify or display workload configuration values. - Modify or display workload configuration values. + 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. 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 index 58f4dc222a50..06ccf667f917 100644 --- a/src/Cli/dotnet/commands/dotnet-workload/config/xlf/LocalizableStrings.pl.xlf +++ b/src/Cli/dotnet/commands/dotnet-workload/config/xlf/LocalizableStrings.pl.xlf @@ -3,8 +3,15 @@ - Modify or display workload configuration values. - Modify or display workload configuration values. + 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. 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 index 3100530fcd84..27459bb8c5fb 100644 --- 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 @@ -3,8 +3,15 @@ - Modify or display workload configuration values. - Modify or display workload configuration values. + 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. 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 index 15a9601c79e1..5a490dbba2f5 100644 --- a/src/Cli/dotnet/commands/dotnet-workload/config/xlf/LocalizableStrings.ru.xlf +++ b/src/Cli/dotnet/commands/dotnet-workload/config/xlf/LocalizableStrings.ru.xlf @@ -3,8 +3,15 @@ - Modify or display workload configuration values. - Modify or display workload configuration values. + 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. 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 index 0e8ae5ca53ec..07fe44de371f 100644 --- a/src/Cli/dotnet/commands/dotnet-workload/config/xlf/LocalizableStrings.tr.xlf +++ b/src/Cli/dotnet/commands/dotnet-workload/config/xlf/LocalizableStrings.tr.xlf @@ -3,8 +3,15 @@ - Modify or display workload configuration values. - Modify or display workload configuration values. + 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. 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 index 886acc5bc439..41a4543b7566 100644 --- 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 @@ -3,8 +3,15 @@ - Modify or display workload configuration values. - Modify or display workload configuration values. + 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. 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 index ad00159d81f4..8a8598849d60 100644 --- 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 @@ -3,8 +3,15 @@ - Modify or display workload configuration values. - Modify or display workload configuration values. + 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. From 4a553e1df66b45ca21bb8f2ddfedc6f3e1842fd3 Mon Sep 17 00:00:00 2001 From: Daniel Plaisted Date: Wed, 27 Mar 2024 06:55:47 -0400 Subject: [PATCH 6/9] Add support for changing version of installed SDK in VM tests --- .../Framework/VMAction.cs | 27 +++++++++++- .../Framework/VMTestBase.cs | 41 +++++++++++++++---- .../Framework/VirtualMachine.cs | 8 ++++ 3 files changed, 67 insertions(+), 9 deletions(-) diff --git a/src/Tests/dotnet-MsiInstallation.Tests/Framework/VMAction.cs b/src/Tests/dotnet-MsiInstallation.Tests/Framework/VMAction.cs index 34ca1f806ebf..9a7cb527cca7 100644 --- a/src/Tests/dotnet-MsiInstallation.Tests/Framework/VMAction.cs +++ b/src/Tests/dotnet-MsiInstallation.Tests/Framework/VMAction.cs @@ -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/Framework/VMTestBase.cs b/src/Tests/dotnet-MsiInstallation.Tests/Framework/VMTestBase.cs index ea73e4c54f41..89b3a2054617 100644 --- a/src/Tests/dotnet-MsiInstallation.Tests/Framework/VMTestBase.cs +++ b/src/Tests/dotnet-MsiInstallation.Tests/Framework/VMTestBase.cs @@ -76,21 +76,48 @@ protected void DeployStage2Sdk() 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))) + 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"); diff --git a/src/Tests/dotnet-MsiInstallation.Tests/Framework/VirtualMachine.cs b/src/Tests/dotnet-MsiInstallation.Tests/Framework/VirtualMachine.cs index b075df512e4a..ac2496bf64a9 100644 --- a/src/Tests/dotnet-MsiInstallation.Tests/Framework/VirtualMachine.cs +++ b/src/Tests/dotnet-MsiInstallation.Tests/Framework/VirtualMachine.cs @@ -299,6 +299,14 @@ VMActionResult Run(SerializedVMAction action) return VMActionResult.Success(); } + else if (action.Type == VMActionType.MoveFolderOnVM) + { + var sourceSharePath = VMPathToSharePath(action.SourcePath); + var targetSharePath = VMPathToSharePath(action.TargetPath); + Directory.Move(sourceSharePath, targetSharePath); + + return VMActionResult.Success(); + } else if (action.Type == VMActionType.WriteFileToVM) { var targetSharePath = VMPathToSharePath(action.TargetPath); From 6bbd2b72c16454d3ee14850e0d79a17297b1ecab Mon Sep 17 00:00:00 2001 From: Daniel Plaisted Date: Wed, 27 Mar 2024 07:32:19 -0400 Subject: [PATCH 7/9] Add test for updating workloads in workload set mode with no workload sets available --- .../WorkloadSetTests.cs | 52 ++++++++++++++----- 1 file changed, 38 insertions(+), 14 deletions(-) diff --git a/src/Tests/dotnet-MsiInstallation.Tests/WorkloadSetTests.cs b/src/Tests/dotnet-MsiInstallation.Tests/WorkloadSetTests.cs index 994ba0160c49..926688a175c8 100644 --- a/src/Tests/dotnet-MsiInstallation.Tests/WorkloadSetTests.cs +++ b/src/Tests/dotnet-MsiInstallation.Tests/WorkloadSetTests.cs @@ -7,6 +7,7 @@ using System.Text; using System.Threading.Tasks; using Microsoft.DotNet.MsiInstallerTests.Framework; +using Microsoft.NET.Sdk.WorkloadManifestReader; namespace Microsoft.DotNet.MsiInstallerTests { @@ -65,11 +66,8 @@ public void DoesNotUseWorkloadSetsByDefault() } - [Fact] - public void UpdateWithWorkloadSets() + void UpdateAndSwitchToWorkloadSetMode(out string updatedWorkloadVersion, out WorkloadSet rollbackAfterUpdate) { - InstallSdk(); - var originalWorkloadVersion = GetWorkloadVersion(); originalWorkloadVersion.Should().StartWith("8.0.200-manifests."); @@ -78,17 +76,11 @@ public void UpdateWithWorkloadSets() .Should() .Pass(); - var originalRollback = GetRollback(); - var updatedWorkloadVersion = GetWorkloadVersion(); + rollbackAfterUpdate = GetRollback(); + updatedWorkloadVersion = GetWorkloadVersion(); updatedWorkloadVersion.Should().StartWith("8.0.200-manifests."); updatedWorkloadVersion.Should().NotBe(originalWorkloadVersion); - VM.CreateRunCommand("dotnet", "nuget", "add", "source", @"c:\SdkTesting\WorkloadSets") - .WithDescription("Add WorkloadSets to NuGet.config") - .Execute() - .Should() - .Pass(); - GetUpdateMode().Should().Be("manifests"); VM.CreateRunCommand("dotnet", "workload", "config", "--update-mode", "workload-set") @@ -100,18 +92,50 @@ public void UpdateWithWorkloadSets() GetWorkloadVersion().Should().Be(updatedWorkloadVersion); GetUpdateMode().Should().Be("workload-set"); + } - VM.CreateRunCommand("dotnet", "workload", "update") + [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(originalRollback.ManifestVersions); + 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() From d8844976740d053aecca683585daacec775aac6a Mon Sep 17 00:00:00 2001 From: Daniel Plaisted Date: Wed, 27 Mar 2024 12:43:59 -0400 Subject: [PATCH 8/9] Remove `dotnet workload update --mode ` The replacement is `dotnet workload config --update-mode `. --- .../commands/InstallingWorkloadCommand.cs | 6 ------ .../install/LocalizableStrings.resx | 3 --- .../install/xlf/LocalizableStrings.cs.xlf | 5 ----- .../install/xlf/LocalizableStrings.de.xlf | 5 ----- .../install/xlf/LocalizableStrings.es.xlf | 5 ----- .../install/xlf/LocalizableStrings.fr.xlf | 5 ----- .../install/xlf/LocalizableStrings.it.xlf | 5 ----- .../install/xlf/LocalizableStrings.ja.xlf | 5 ----- .../install/xlf/LocalizableStrings.ko.xlf | 5 ----- .../install/xlf/LocalizableStrings.pl.xlf | 5 ----- .../install/xlf/LocalizableStrings.pt-BR.xlf | 5 ----- .../install/xlf/LocalizableStrings.ru.xlf | 5 ----- .../install/xlf/LocalizableStrings.tr.xlf | 5 ----- .../xlf/LocalizableStrings.zh-Hans.xlf | 5 ----- .../xlf/LocalizableStrings.zh-Hant.xlf | 5 ----- .../update/LocalizableStrings.resx | 5 +---- .../update/WorkloadUpdateCommand.cs | 19 ------------------- .../update/WorkloadUpdateCommandParser.cs | 1 - .../update/xlf/LocalizableStrings.cs.xlf | 5 ----- .../update/xlf/LocalizableStrings.de.xlf | 5 ----- .../update/xlf/LocalizableStrings.es.xlf | 5 ----- .../update/xlf/LocalizableStrings.fr.xlf | 5 ----- .../update/xlf/LocalizableStrings.it.xlf | 5 ----- .../update/xlf/LocalizableStrings.ja.xlf | 5 ----- .../update/xlf/LocalizableStrings.ko.xlf | 5 ----- .../update/xlf/LocalizableStrings.pl.xlf | 5 ----- .../update/xlf/LocalizableStrings.pt-BR.xlf | 5 ----- .../update/xlf/LocalizableStrings.ru.xlf | 5 ----- .../update/xlf/LocalizableStrings.tr.xlf | 5 ----- .../update/xlf/LocalizableStrings.zh-Hans.xlf | 5 ----- .../update/xlf/LocalizableStrings.zh-Hant.xlf | 5 ----- 31 files changed, 1 insertion(+), 163 deletions(-) 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/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. 已成功更新廣告資訊清單。 From 7ecfc8a565ec251f286301a22b9fa2bc7f549b2c Mon Sep 17 00:00:00 2001 From: Daniel Plaisted Date: Wed, 3 Apr 2024 23:42:47 -0400 Subject: [PATCH 9/9] Code review feedback and cleanup --- .../config/WorkloadConfigCommand.cs | 13 ++++++------ .../config/WorkloadConfigCommandParser.cs | 1 - .../WorkloadSetTests.cs | 20 ------------------- 3 files changed, 7 insertions(+), 27 deletions(-) diff --git a/src/Cli/dotnet/commands/dotnet-workload/config/WorkloadConfigCommand.cs b/src/Cli/dotnet/commands/dotnet-workload/config/WorkloadConfigCommand.cs index 0329b3770bca..1923511703e8 100644 --- a/src/Cli/dotnet/commands/dotnet-workload/config/WorkloadConfigCommand.cs +++ b/src/Cli/dotnet/commands/dotnet-workload/config/WorkloadConfigCommand.cs @@ -20,9 +20,9 @@ namespace Microsoft.DotNet.Workloads.Workload.Config { internal class WorkloadConfigCommand : WorkloadCommandBase { - bool _hasUpdateMode; - string? _updateMode; - readonly IWorkloadResolverFactory _workloadResolverFactory; + private bool _hasUpdateMode; + private string? _updateMode; + private readonly IWorkloadResolverFactory _workloadResolverFactory; private string? _dotnetPath; private string _userProfileDir; @@ -38,7 +38,6 @@ public WorkloadConfigCommand( IWorkloadResolverFactory? workloadResolverFactory = null ) : base(parseResult, CommonOptions.HiddenVerbosityOption, reporter) { - // TODO: Is it possible to check the order of the options? This would allow us to print the values out in the same order they are specified on the command line _hasUpdateMode = parseResult.HasOption(WorkloadConfigCommandParser.UpdateMode); _updateMode = parseResult.GetValue(WorkloadConfigCommandParser.UpdateMode); @@ -57,13 +56,15 @@ public WorkloadConfigCommand( 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 (_updateMode == WorkloadConfigCommandParser.UpdateMode_WorkloadSet) + if (WorkloadConfigCommandParser.UpdateMode_WorkloadSet.Equals(_updateMode, StringComparison.InvariantCultureIgnoreCase)) { _workloadInstaller.UpdateInstallMode(_sdkFeatureBand, true); } - else if (_updateMode == WorkloadConfigCommandParser.UpdateMode_Manifests) + else if (WorkloadConfigCommandParser.UpdateMode_Manifests.Equals(_updateMode, StringComparison.InvariantCultureIgnoreCase)) { _workloadInstaller.UpdateInstallMode(_sdkFeatureBand, false); } diff --git a/src/Cli/dotnet/commands/dotnet-workload/config/WorkloadConfigCommandParser.cs b/src/Cli/dotnet/commands/dotnet-workload/config/WorkloadConfigCommandParser.cs index ee1a96ba73a5..22114beef478 100644 --- a/src/Cli/dotnet/commands/dotnet-workload/config/WorkloadConfigCommandParser.cs +++ b/src/Cli/dotnet/commands/dotnet-workload/config/WorkloadConfigCommandParser.cs @@ -16,7 +16,6 @@ internal static class WorkloadConfigCommandParser public static readonly CliOption UpdateMode = new("--update-mode") { Description = LocalizableStrings.UpdateModeDescription, - //Hidden = true, Arity = ArgumentArity.ZeroOrOne }; diff --git a/src/Tests/dotnet-MsiInstallation.Tests/WorkloadSetTests.cs b/src/Tests/dotnet-MsiInstallation.Tests/WorkloadSetTests.cs index 926688a175c8..2718d39cedc1 100644 --- a/src/Tests/dotnet-MsiInstallation.Tests/WorkloadSetTests.cs +++ b/src/Tests/dotnet-MsiInstallation.Tests/WorkloadSetTests.cs @@ -17,26 +17,6 @@ public WorkloadSetTests(ITestOutputHelper log) : base(log) { } - // dotnet nuget add source c:\SdkTesting\WorkloadSets - // dotnet workload update --mode workloadset - - // Show workload mode in dotnet workload --info - - - // dotnet workload update-mode set workload-set - - // dotnet workload config --update-mode workload-set - - // dotnet workload config update-mode - // dotnet workload config update-mode workload-set - // dotnet workload config update-mode manifests - - // dotnet workload config update-band [default|release|preview|daily] - - // dotnet config workload.update-mode workload-set - - // dotnet setconfig --workload-update-mode workload-set - [Fact] public void DoesNotUseWorkloadSetsByDefault() {