@@ -66,26 +66,11 @@ protected void InstallSdk(bool deployStage2 = true)
66
66
. Should ( )
67
67
. Pass ( ) ;
68
68
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 ( ) ;
80
72
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
+
89
74
90
75
if ( deployStage2 )
91
76
{
@@ -109,6 +94,27 @@ protected void DeployStage2Sdk()
109
94
return ;
110
95
}
111
96
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
+
112
118
var result = VM . CreateRunCommand ( "dotnet" , "--version" )
113
119
. WithIsReadOnly ( true )
114
120
. Execute ( ) ;
0 commit comments