|
4 | 4 | using System.Diagnostics.CodeAnalysis;
|
5 | 5 | using System.Runtime.CompilerServices;
|
6 | 6 | using Microsoft.DotNet.Cli;
|
| 7 | +using Microsoft.DotNet.Workloads.Workload; |
7 | 8 | using Microsoft.NET.Sdk.Localization;
|
8 | 9 | using Microsoft.NET.Sdk.WorkloadManifestReader;
|
9 | 10 |
|
@@ -418,6 +419,13 @@ public void WorkloadSetCanIncludeMultipleJsonFiles()
|
418 | 419 | CreateMockManifest(_manifestRoot, "8.0.200", "android", "33.0.2-rc.1", true);
|
419 | 420 | CreateMockManifest(_manifestRoot, "8.0.200", "android", "33.0.2", true);
|
420 | 421 |
|
| 422 | + // To prepare the resolver to work with workload sets, we need to specify 'workload sets' in the install state file. |
| 423 | + var installStateLocation = WorkloadInstallType.GetInstallStateFolder(new SdkFeatureBand("8.0.200"), Path.GetDirectoryName(_manifestRoot)!); |
| 424 | + var installStateFilePath = Path.Combine(installStateLocation, "default.json"); |
| 425 | + var installState = InstallStateContents.FromPath(installStateFilePath); |
| 426 | + installState.UseWorkloadSets = true; |
| 427 | + Directory.CreateDirectory(installStateLocation); |
| 428 | + File.WriteAllText(installStateFilePath, installState.ToString()); |
421 | 429 |
|
422 | 430 | var workloadSetDirectory = Path.Combine(_manifestRoot, "8.0.200", "workloadsets", "8.0.200");
|
423 | 431 | Directory.CreateDirectory(workloadSetDirectory);
|
@@ -1254,6 +1262,14 @@ private void CreateMockManifest(string manifestRoot, string featureBand, string
|
1254 | 1262 |
|
1255 | 1263 | private void CreateMockWorkloadSet(string manifestRoot, string featureBand, string workloadSetVersion, string workloadSetContents)
|
1256 | 1264 | {
|
| 1265 | + // To prepare the resolver to work with workload sets, we need to specify 'workload sets' in the install state file. |
| 1266 | + var installStateLocation = WorkloadInstallType.GetInstallStateFolder(new SdkFeatureBand(featureBand), Path.GetDirectoryName(manifestRoot)!); |
| 1267 | + var installStateFilePath = Path.Combine(installStateLocation, "default.json"); |
| 1268 | + var installState = InstallStateContents.FromPath(installStateFilePath); |
| 1269 | + installState.UseWorkloadSets = true; |
| 1270 | + Directory.CreateDirectory(installStateLocation); |
| 1271 | + File.WriteAllText(installStateFilePath, installState.ToString()); |
| 1272 | + |
1257 | 1273 | var workloadSetDirectory = Path.Combine(manifestRoot, featureBand, "workloadsets", workloadSetVersion);
|
1258 | 1274 | if (!Directory.Exists(workloadSetDirectory))
|
1259 | 1275 | {
|
|
0 commit comments