Skip to content

Commit 6ac1637

Browse files
committed
Only install additional runtimes when deploying stage 2
1 parent 4f75e80 commit 6ac1637

File tree

1 file changed

+25
-19
lines changed

1 file changed

+25
-19
lines changed

src/Tests/dotnet-MsiInstallation.Tests/Framework/VMTestBase.cs

Lines changed: 25 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -66,26 +66,11 @@ protected void InstallSdk(bool deployStage2 = true)
6666
.Should()
6767
.Pass();
6868

69-
var sdkTestingDir = VM.GetRemoteDirectory(@"c:\SdkTesting");
70-
List<string> runtimeInstallers = new List<string>();
71-
string installerPrefix = "dotnet-runtime-";
72-
string installerSuffix = "-win-x64.exe";
73-
foreach (var file in sdkTestingDir.Files.Select(Path.GetFileName))
74-
{
75-
if (file.StartsWith(installerPrefix) && file.EndsWith(installerSuffix))
76-
{
77-
runtimeInstallers.Add(file);
78-
}
79-
}
69+
VM.CreateRunCommand($@"c:\SdkTesting\{SdkInstallerFileName}", "/quiet")
70+
.WithDescription($"Install SDK {SdkInstallerVersion}")
71+
.Execute().Should().Pass();
8072

81-
VM.CreateActionGroup($"Install SDK {SdkInstallerVersion}",
82-
[
83-
VM.CreateRunCommand($@"c:\SdkTesting\{SdkInstallerFileName}", "/quiet"),
84-
..runtimeInstallers.Select(i => VM.CreateRunCommand($@"c:\SdkTesting\{i}", "/quiet"))
85-
])
86-
.Execute()
87-
.Should()
88-
.Pass();
73+
8974

9075
if (deployStage2)
9176
{
@@ -109,6 +94,27 @@ protected void DeployStage2Sdk()
10994
return;
11095
}
11196

97+
98+
// Install any runtimes that are in the c:\SdkTesting directory, to support using older baseline SDK versions with a newer stage 2
99+
var sdkTestingDir = VM.GetRemoteDirectory(@"c:\SdkTesting");
100+
List<string> runtimeInstallers = new List<string>();
101+
string installerPrefix = "dotnet-runtime-";
102+
string installerSuffix = "-win-x64.exe";
103+
foreach (var file in sdkTestingDir.Files.Select(Path.GetFileName))
104+
{
105+
if (file.StartsWith(installerPrefix) && file.EndsWith(installerSuffix))
106+
{
107+
runtimeInstallers.Add(file);
108+
}
109+
}
110+
111+
if (runtimeInstallers.Any())
112+
{
113+
VM.CreateActionGroup($"Install .NET runtime(s)",
114+
runtimeInstallers.Select(i => VM.CreateRunCommand($@"c:\SdkTesting\{i}", "/quiet")).ToArray())
115+
.Execute().Should().Pass();
116+
}
117+
112118
var result = VM.CreateRunCommand("dotnet", "--version")
113119
.WithIsReadOnly(true)
114120
.Execute();

0 commit comments

Comments
 (0)