Skip to content

Commit 61a87e6

Browse files
committed
Fix workload restore with global.json-specified workload version
1 parent 8634876 commit 61a87e6

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/Cli/dotnet/commands/dotnet-workload/install/WorkloadInstallCommand.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,9 @@ public override int Execute()
122122
throw new GracefulException(string.Format(LocalizableStrings.CannotCombineSkipManifestAndVersion,
123123
WorkloadInstallCommandParser.SkipManifestUpdateOption.Name, InstallingWorkloadCommandParser.VersionOption.Name), isUserError: true);
124124
}
125-
else if (_skipManifestUpdate && SpecifiedWorkloadSetVersionInGlobalJson)
125+
else if ((_skipManifestUpdate && SpecifiedWorkloadSetVersionInGlobalJson) &&
126+
!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.
127+
// When we run the install command we set skipManifestUpdate to true as an optimization to avoid trying to update twice
126128
{
127129
throw new GracefulException(string.Format(LocalizableStrings.CannotUseSkipManifestWithGlobalJsonWorkloadVersion,
128130
WorkloadInstallCommandParser.SkipManifestUpdateOption.Name, _globalJsonPath), isUserError: true);

0 commit comments

Comments
 (0)