Skip to content

Commit 8ebaffd

Browse files
committed
Fix installing and updating workloads with global.json-specified workload set version
1 parent 2807892 commit 8ebaffd

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,6 @@ public override int Execute()
141141
Reporter.WriteLine(string.Format(LocalizableStrings.WorkloadAlreadyInstalled, string.Join(" ", previouslyInstalledWorkloads)).Yellow());
142142
}
143143
workloadIds = workloadIds.Concat(installedWorkloads).Distinct();
144-
workloadIds = WriteSDKInstallRecordsForVSWorkloads(workloadIds);
145144

146145
if (!_skipManifestUpdate)
147146
{
@@ -168,6 +167,10 @@ public override int Execute()
168167
}
169168
UpdateWorkloadManifests(context, offlineCache);
170169
}
170+
171+
// This depends on getting the available workloads, so it needs to run after manifests hae potentially been installed
172+
workloadIds = WriteSDKInstallRecordsForVSWorkloads(workloadIds);
173+
171174
_workloadInstaller.InstallWorkloads(workloadIds, _sdkFeatureBand, context, offlineCache);
172175

173176
// Write workload installation records

src/Cli/dotnet/commands/dotnet-workload/update/WorkloadUpdateCommand.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,13 +94,17 @@ public override int Execute()
9494
Reporter.WriteLine();
9595
try
9696
{
97-
var workloadIds = WriteSDKInstallRecordsForVSWorkloads(GetUpdatableWorkloads());
97+
IEnumerable<WorkloadId> workloadIds = Enumerable.Empty<WorkloadId>();
9898

9999
DirectoryPath? offlineCache = string.IsNullOrWhiteSpace(_fromCacheOption) ? null : new DirectoryPath(_fromCacheOption);
100100

101101
RunInNewTransaction(context =>
102102
{
103103
UpdateWorkloadManifests(context, offlineCache);
104+
105+
// This depends on getting the available workloads, so it needs to run after manifests hae potentially been installed
106+
workloadIds = WriteSDKInstallRecordsForVSWorkloads(GetUpdatableWorkloads());
107+
104108
_workloadInstaller.InstallWorkloads(workloadIds, _sdkFeatureBand, context, offlineCache);
105109
});
106110

0 commit comments

Comments
 (0)