@@ -42,6 +42,9 @@ public bool SetupEnvironment()
42
42
var dotnetEFFullPath = Path . Combine ( nugetRestore , helixDir , "dotnet-ef.exe" ) ;
43
43
Console . WriteLine ( $ "Set DotNetEfFullPath: { dotnetEFFullPath } ") ;
44
44
EnvironmentVariables . Add ( "DotNetEfFullPath" , dotnetEFFullPath ) ;
45
+ var appRuntimePath = $ "{ Options . DotnetRoot } /shared/Microsoft.AspNetCore.App/{ Options . RuntimeVersion } ";
46
+ Console . WriteLine ( $ "Set ASPNET_RUNTIME_PATH: { appRuntimePath } ") ;
47
+ EnvironmentVariables . Add ( "ASPNET_RUNTIME_PATH" , appRuntimePath ) ;
45
48
46
49
#if INSTALLPLAYWRIGHT
47
50
// Playwright will download and look for browsers to this directory
@@ -66,6 +69,8 @@ public bool SetupEnvironment()
66
69
67
70
DisplayContents ( Path . Combine ( Options . DotnetRoot , "host" , "fxr" ) ) ;
68
71
DisplayContents ( Path . Combine ( Options . DotnetRoot , "shared" , "Microsoft.NETCore.App" ) ) ;
72
+ DisplayContents ( Path . Combine ( Options . DotnetRoot , "shared" , "Microsoft.AspNetCore.App" ) ) ;
73
+ DisplayContents ( Path . Combine ( Options . DotnetRoot , "packs" , "Microsoft.AspNetCore.App.Ref" ) ) ;
69
74
70
75
return true ;
71
76
}
@@ -116,129 +121,57 @@ public async Task<bool> InstallPlaywrightAsync()
116
121
}
117
122
#endif
118
123
119
- public async Task < bool > InstallAspNetAppIfNeededAsync ( )
124
+ public async Task < bool > InstallDotnetToolsAsync ( )
120
125
{
121
126
try
122
127
{
123
- if ( File . Exists ( Options . AspNetRuntime ) )
124
- {
125
- var appRuntimePath = $ "{ Options . DotnetRoot } /shared/Microsoft.AspNetCore.App/{ Options . RuntimeVersion } ";
126
- Console . WriteLine ( $ "Creating directory: { appRuntimePath } ") ;
127
- Directory . CreateDirectory ( appRuntimePath ) ;
128
- Console . WriteLine ( $ "Set ASPNET_RUNTIME_PATH: { appRuntimePath } ") ;
129
- EnvironmentVariables . Add ( "ASPNET_RUNTIME_PATH" , appRuntimePath ) ;
130
- Console . WriteLine ( $ "Found AspNetRuntime: { Options . AspNetRuntime } , extracting *.txt,json,dll,xml to { appRuntimePath } ") ;
131
- using ( var archive = ZipFile . OpenRead ( Options . AspNetRuntime ) )
132
- {
133
- foreach ( var entry in archive . Entries )
134
- {
135
- // These are the only extensions that end up in the shared fx directory
136
- if ( entry . Name . EndsWith ( ".txt" , StringComparison . OrdinalIgnoreCase ) ||
137
- entry . Name . EndsWith ( ".json" , StringComparison . OrdinalIgnoreCase ) ||
138
- entry . Name . EndsWith ( ".dll" , StringComparison . OrdinalIgnoreCase ) ||
139
- entry . Name . EndsWith ( ".xml" , StringComparison . OrdinalIgnoreCase ) )
140
- {
141
- entry . ExtractToFile ( Path . Combine ( appRuntimePath , entry . Name ) , overwrite : true ) ;
142
- }
143
- }
144
- }
145
-
146
- DisplayContents ( appRuntimePath ) ;
147
-
148
- Console . WriteLine ( $ "Adding current directory to nuget sources: { Options . HELIX_WORKITEM_ROOT } ") ;
149
-
150
- await ProcessUtil . RunAsync ( $ "{ Options . DotnetRoot } /dotnet",
151
- $ "nuget add source { Options . HELIX_WORKITEM_ROOT } --configfile NuGet.config",
152
- environmentVariables : EnvironmentVariables ,
153
- outputDataReceived : Console . WriteLine ,
154
- errorDataReceived : Console . Error . WriteLine ,
155
- throwOnError : false ,
156
- cancellationToken : new CancellationTokenSource ( TimeSpan . FromMinutes ( 2 ) ) . Token ) ;
157
-
158
- // Write nuget sources to console, useful for debugging purposes
159
- await ProcessUtil . RunAsync ( $ "{ Options . DotnetRoot } /dotnet",
160
- "nuget list source" ,
161
- environmentVariables : EnvironmentVariables ,
162
- outputDataReceived : Console . WriteLine ,
163
- errorDataReceived : Console . Error . WriteLine ,
164
- throwOnError : false ,
165
- cancellationToken : new CancellationTokenSource ( TimeSpan . FromMinutes ( 2 ) ) . Token ) ;
166
-
167
- await ProcessUtil . RunAsync ( $ "{ Options . DotnetRoot } /dotnet",
168
- $ "tool install dotnet-ef --version { Options . EfVersion } --tool-path { Options . HELIX_WORKITEM_ROOT } ",
169
- environmentVariables : EnvironmentVariables ,
170
- outputDataReceived : Console . WriteLine ,
171
- errorDataReceived : Console . Error . WriteLine ,
172
- throwOnError : false ,
173
- cancellationToken : new CancellationTokenSource ( TimeSpan . FromMinutes ( 2 ) ) . Token ) ;
128
+ Console . WriteLine ( $ "Adding current directory to nuget sources: { Options . HELIX_WORKITEM_ROOT } ") ;
174
129
175
- await ProcessUtil . RunAsync ( $ "{ Options . DotnetRoot } /dotnet",
176
- $ "tool install dotnet-serve --tool-path { Options . HELIX_WORKITEM_ROOT } ",
177
- environmentVariables : EnvironmentVariables ,
178
- outputDataReceived : Console . WriteLine ,
179
- errorDataReceived : Console . Error . WriteLine ,
180
- throwOnError : false ,
181
- cancellationToken : new CancellationTokenSource ( TimeSpan . FromMinutes ( 2 ) ) . Token ) ;
182
-
183
- // ';' is the path separator on Windows, and ':' on Unix
184
- Options . Path += OperatingSystem . IsWindows ( ) ? ";" : ":" ;
185
- Options . Path += $ "{ Environment . GetEnvironmentVariable ( "DOTNET_CLI_HOME" ) } /.dotnet/tools";
186
- EnvironmentVariables [ "PATH" ] = Options . Path ;
187
- }
188
- else
189
- {
190
- Console . WriteLine ( $ "No AspNetRuntime found: { Options . AspNetRuntime } , skipping...") ;
191
- }
192
- return true ;
193
- }
194
- catch ( Exception e )
195
- {
196
- Console . WriteLine ( $ "Exception in InstallAspNetAppIfNeeded: { e . ToString ( ) } ") ;
197
- return false ;
198
- }
199
- }
130
+ await ProcessUtil . RunAsync ( $ "{ Options . DotnetRoot } /dotnet",
131
+ $ "nuget add source { Options . HELIX_WORKITEM_ROOT } --configfile NuGet.config",
132
+ environmentVariables : EnvironmentVariables ,
133
+ outputDataReceived : Console . WriteLine ,
134
+ errorDataReceived : Console . Error . WriteLine ,
135
+ throwOnError : false ,
136
+ cancellationToken : new CancellationTokenSource ( TimeSpan . FromMinutes ( 2 ) ) . Token ) ;
200
137
201
- public bool InstallAspNetRefIfNeeded ( )
202
- {
203
- try
204
- {
205
- if ( File . Exists ( Options . AspNetRef ) )
206
- {
207
- var refPath = $ "{ Options . DotnetRoot } /packs/Microsoft.AspNetCore.App.Ref/{ Options . RuntimeVersion } ";
208
- Console . WriteLine ( $ "Found AspNetRef: { Options . AspNetRef } , extracting to { refPath } ") ;
209
- ZipFile . ExtractToDirectory ( Options . AspNetRef , refPath ) ;
138
+ // Write nuget sources to console, useful for debugging purposes
139
+ await ProcessUtil . RunAsync ( $ "{ Options . DotnetRoot } /dotnet",
140
+ "nuget list source" ,
141
+ environmentVariables : EnvironmentVariables ,
142
+ outputDataReceived : Console . WriteLine ,
143
+ errorDataReceived : Console . Error . WriteLine ,
144
+ throwOnError : false ,
145
+ cancellationToken : new CancellationTokenSource ( TimeSpan . FromMinutes ( 2 ) ) . Token ) ;
210
146
211
- DisplayContents ( refPath ) ;
212
- }
213
- else
214
- {
215
- Console . WriteLine ( $ "No AspNetRef found: { Options . AspNetRef } , skipping...") ;
216
- }
217
- return true ;
218
- }
219
- catch ( Exception e )
220
- {
221
- Console . WriteLine ( $ "Exception in InstallAspNetRefIfNeeded: { e . ToString ( ) } ") ;
222
- return false ;
223
- }
224
- }
147
+ await ProcessUtil . RunAsync ( $ "{ Options . DotnetRoot } /dotnet",
148
+ $ "tool install dotnet-ef --version { Options . EfVersion } --tool-path { Options . HELIX_WORKITEM_ROOT } ",
149
+ environmentVariables : EnvironmentVariables ,
150
+ outputDataReceived : Console . WriteLine ,
151
+ errorDataReceived : Console . Error . WriteLine ,
152
+ throwOnError : false ,
153
+ cancellationToken : new CancellationTokenSource ( TimeSpan . FromMinutes ( 2 ) ) . Token ) ;
225
154
226
- public async Task < bool > InstallDotnetDump ( )
227
- {
228
- try
229
- {
230
155
await ProcessUtil . RunAsync ( $ "{ Options . DotnetRoot } /dotnet",
231
- $ "tool install dotnet-dump --tool-path { Options . HELIX_WORKITEM_ROOT } --version 5.0.0-*",
232
- environmentVariables : EnvironmentVariables ,
233
- outputDataReceived : Console . WriteLine ,
234
- errorDataReceived : Console . Error . WriteLine ,
235
- throwOnError : false ) ;
156
+ $ "tool install dotnet-serve --tool-path { Options . HELIX_WORKITEM_ROOT } ",
157
+ environmentVariables : EnvironmentVariables ,
158
+ outputDataReceived : Console . WriteLine ,
159
+ errorDataReceived : Console . Error . WriteLine ,
160
+ throwOnError : false ,
161
+ cancellationToken : new CancellationTokenSource ( TimeSpan . FromMinutes ( 2 ) ) . Token ) ;
162
+
163
+ await ProcessUtil . RunAsync ( $ "{ Options . DotnetRoot } /dotnet",
164
+ $ "tool install dotnet-dump --tool-path { Options . HELIX_WORKITEM_ROOT } --version 5.0.0-*",
165
+ environmentVariables : EnvironmentVariables ,
166
+ outputDataReceived : Console . WriteLine ,
167
+ errorDataReceived : Console . Error . WriteLine ,
168
+ throwOnError : false ) ;
236
169
237
170
return true ;
238
171
}
239
172
catch ( Exception e )
240
173
{
241
- Console . WriteLine ( $ "Exception in InstallDotnetDump : { e } ") ;
174
+ Console . WriteLine ( $ "Exception in InstallDotnetTools : { e } ") ;
242
175
return false ;
243
176
}
244
177
}
0 commit comments