From 83ad52f729517cf432d183299dad06bcbc106742 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 5 Dec 2025 23:52:24 +0000 Subject: [PATCH 1/3] Initial plan From edc2c9fc1b7e1398d74f45edeace848929fe98e7 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 6 Dec 2025 00:08:04 +0000 Subject: [PATCH 2/3] Fix workload restore --version conflict with skip-manifest-update Co-authored-by: marcpopMSFT <12663534+marcpopMSFT@users.noreply.github.com> --- .../Install/WorkloadInstallCommand.cs | 4 ++- .../Restore/GivenDotnetWorkloadRestore.cs | 25 +++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/src/Cli/dotnet/Commands/Workload/Install/WorkloadInstallCommand.cs b/src/Cli/dotnet/Commands/Workload/Install/WorkloadInstallCommand.cs index 15049f909b09..ceff25cd8884 100644 --- a/src/Cli/dotnet/Commands/Workload/Install/WorkloadInstallCommand.cs +++ b/src/Cli/dotnet/Commands/Workload/Install/WorkloadInstallCommand.cs @@ -155,7 +155,9 @@ public override int Execute() throw new GracefulException(string.Format(CliCommandStrings.CannotCombineSkipManifestAndRollback, WorkloadInstallCommandParser.SkipManifestUpdateOption.Name, InstallingWorkloadCommandParser.FromRollbackFileOption.Name), isUserError: true); } - else if (_skipManifestUpdate && SpecifiedWorkloadSetVersionOnCommandLine) + else if (_skipManifestUpdate && SpecifiedWorkloadSetVersionOnCommandLine && + !IsRunningRestore) // When running restore, we first update workloads, then query the projects to figure out what workloads should be installed, then run the install command. + // When we run the install command we set skipManifestUpdate to true as an optimization to avoid trying to update twice { throw new GracefulException(string.Format(CliCommandStrings.CannotCombineSkipManifestAndVersion, WorkloadInstallCommandParser.SkipManifestUpdateOption.Name, InstallingWorkloadCommandParser.VersionOption.Name), isUserError: true); diff --git a/test/dotnet.Tests/CommandTests/Workload/Restore/GivenDotnetWorkloadRestore.cs b/test/dotnet.Tests/CommandTests/Workload/Restore/GivenDotnetWorkloadRestore.cs index 301293b0141f..37aad16efd1d 100644 --- a/test/dotnet.Tests/CommandTests/Workload/Restore/GivenDotnetWorkloadRestore.cs +++ b/test/dotnet.Tests/CommandTests/Workload/Restore/GivenDotnetWorkloadRestore.cs @@ -58,6 +58,31 @@ public void ProjectsThatDoNotSupportWorkloadsAndAreTransitivelyReferencedDoNotBr .Pass(); } + [Fact] + public void VersionOptionShouldNotConflictWithSkipManifestUpdate() + { + if(IsRunningInContainer()) + { + // Skipping test in a Helix container environment due to read-only DOTNET_ROOT, which causes workload restore to fail when writing workload metadata. + return; + } + + var projectPath = + _testAssetsManager + .CopyTestAsset(TransitiveReferenceNoWorkloadsAssetName) + .WithSource() + .Path; + + var result = new DotnetWorkloadCommand(Log, "restore", "--version", "9.0.100") + .WithWorkingDirectory(projectPath) + .Execute(); + + // Should not fail with "Cannot use the --skip-manifest-update and --sdk-version options together" + // The command may fail for other reasons (e.g., version not found), but it should not fail with the skip-manifest-update error + result.StdErr.Should().NotContain("Cannot use the"); + result.StdErr.Should().NotContain("--skip-manifest-update"); + } + private bool IsRunningInContainer() { if (!File.Exists("/.dockerenv")) From 7c6632044df7626b334cb949aee53a5dcda0943e Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 6 Dec 2025 00:13:08 +0000 Subject: [PATCH 3/3] Fix code formatting issues Co-authored-by: marcpopMSFT <12663534+marcpopMSFT@users.noreply.github.com> --- .../Workload/Restore/GivenDotnetWorkloadRestore.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/dotnet.Tests/CommandTests/Workload/Restore/GivenDotnetWorkloadRestore.cs b/test/dotnet.Tests/CommandTests/Workload/Restore/GivenDotnetWorkloadRestore.cs index 37aad16efd1d..d36199b3df81 100644 --- a/test/dotnet.Tests/CommandTests/Workload/Restore/GivenDotnetWorkloadRestore.cs +++ b/test/dotnet.Tests/CommandTests/Workload/Restore/GivenDotnetWorkloadRestore.cs @@ -15,7 +15,7 @@ public GivenDotnetWorkloadRestore(ITestOutputHelper log) : base(log) [Fact] public void ProjectsThatDoNotSupportWorkloadsAreNotInspected() { - if(IsRunningInContainer()) + if (IsRunningInContainer()) { // Skipping test in a Helix container environment due to read-only DOTNET_ROOT, which causes workload restore to fail when writing workload metadata. return; @@ -38,7 +38,7 @@ public void ProjectsThatDoNotSupportWorkloadsAreNotInspected() [Fact] public void ProjectsThatDoNotSupportWorkloadsAndAreTransitivelyReferencedDoNotBreakTheBuild() { - if(IsRunningInContainer()) + if (IsRunningInContainer()) { // Skipping test in a Helix container environment due to read-only DOTNET_ROOT, which causes workload restore to fail when writing workload metadata. return; @@ -61,7 +61,7 @@ public void ProjectsThatDoNotSupportWorkloadsAndAreTransitivelyReferencedDoNotBr [Fact] public void VersionOptionShouldNotConflictWithSkipManifestUpdate() { - if(IsRunningInContainer()) + if (IsRunningInContainer()) { // Skipping test in a Helix container environment due to read-only DOTNET_ROOT, which causes workload restore to fail when writing workload metadata. return;