Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,6 @@ public override int Execute()
Reporter.WriteLine(string.Format(LocalizableStrings.WorkloadAlreadyInstalled, string.Join(" ", previouslyInstalledWorkloads)).Yellow());
}
workloadIds = workloadIds.Concat(installedWorkloads).Distinct();
workloadIds = WriteSDKInstallRecordsForVSWorkloads(workloadIds);

if (!_skipManifestUpdate)
{
Expand All @@ -168,6 +167,10 @@ public override int Execute()
}
UpdateWorkloadManifests(context, offlineCache);
}

// This depends on getting the available workloads, so it needs to run after manifests hae potentially been installed
workloadIds = WriteSDKInstallRecordsForVSWorkloads(workloadIds);

_workloadInstaller.InstallWorkloads(workloadIds, _sdkFeatureBand, context, offlineCache);

// Write workload installation records
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,17 @@ public override int Execute()
Reporter.WriteLine();
try
{
var workloadIds = WriteSDKInstallRecordsForVSWorkloads(GetUpdatableWorkloads());
IEnumerable<WorkloadId> workloadIds = Enumerable.Empty<WorkloadId>();

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

RunInNewTransaction(context =>
{
UpdateWorkloadManifests(context, offlineCache);

// This depends on getting the available workloads, so it needs to run after manifests hae potentially been installed
workloadIds = WriteSDKInstallRecordsForVSWorkloads(GetUpdatableWorkloads());

_workloadInstaller.InstallWorkloads(workloadIds, _sdkFeatureBand, context, offlineCache);
});

Expand Down
19 changes: 17 additions & 2 deletions src/Tests/dotnet-MsiInstallation.Tests/Framework/VMTestBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,23 @@ protected void InstallSdk(bool deployStage2 = true)
.Should()
.Pass();

VM.CreateRunCommand($@"c:\SdkTesting\{SdkInstallerFileName}", "/quiet")
.WithDescription($"Install SDK {SdkInstallerVersion}")
var sdkTestingDir = VM.GetRemoteDirectory(@"c:\SdkTesting");
List<string> runtimeInstallers = new List<string>();
string installerPrefix = "dotnet-runtime-";
string installerSuffix = "-win-x64.exe";
foreach (var file in sdkTestingDir.Files.Select(Path.GetFileName))
{
if (file.StartsWith(installerPrefix) && file.EndsWith(installerSuffix))
{
runtimeInstallers.Add(file);
}
}

VM.CreateActionGroup($"Install SDK {SdkInstallerVersion}",
[
VM.CreateRunCommand($@"c:\SdkTesting\{SdkInstallerFileName}", "/quiet"),
..runtimeInstallers.Select(i => VM.CreateRunCommand($@"c:\SdkTesting\{i}", "/quiet"))
])
.Execute()
.Should()
.Pass();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ public void SdkInstallation()
}
else
{
// TODO: This doesn't work if we've installed additional runtimes to support the SDK
VM.GetRemoteDirectory($@"c:\Program Files\dotnet")
.Should()
.NotExist();
Expand Down
3 changes: 1 addition & 2 deletions src/Tests/dotnet-MsiInstallation.Tests/WorkloadSetTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,7 @@ public void UpdateWorkloadSetWithoutAvailableManifests()
VM.CreateRunCommand("dotnet", "workload", "update", "--source", @"c:\SdkTesting\workloadsets")
.Execute()
.Should()
.Pass()
.And.HaveStdOutContaining("No workload update found");
.Fail();

VM.CreateRunCommand("dotnet", "workload", "search")
.WithIsReadOnly(true)
Expand Down