215215 . WithShortName ( "Installing template" ) ;
216216
217217installTemplates . WithShortName ( installTemplates . ShortName ) . Run ( ) . EnsureSuccess ( ) ;
218-
219- foreach ( var framework in frameworks )
220- {
221- var buildProjectDir = Path . Combine ( Path . GetTempPath ( ) , Guid . NewGuid ( ) . ToString ( ) [ ..4 ] ) ;
222- Directory . CreateDirectory ( buildProjectDir ) ;
223- var sampleProjectName = $ "sample project for { framework } ";
224- try
225- {
226- var sampleProjectDir = Path . Combine ( "Samples" , "MySampleLib" , "MySampleLib.Tests" ) ;
227- new DotNetNew ( "build" , $ "--version={ packageVersion } ", "-T" , framework , "--no-restore" )
228- . WithWorkingDirectory ( buildProjectDir )
229- . WithShortName ( $ "Creating a new { sampleProjectName } ")
230- . Run ( ) . EnsureSuccess ( ) ;
231-
232- new DotNetBuild ( )
233- . WithProject ( buildProjectDir )
234- . WithSources ( defaultNuGetSource , Path . Combine ( outputDir , "CSharpInteractive" ) )
235- . WithShortName ( $ "Building the { sampleProjectName } ")
236- . Build ( ) . EnsureSuccess ( ) ;
237-
238- new DotNetRun ( )
239- . WithProject ( buildProjectDir )
240- . WithNoBuild ( true )
241- . WithWorkingDirectory ( sampleProjectDir )
242- . WithShortName ( $ "Running a build for the { sampleProjectName } ")
243- . Run ( ) . EnsureSuccess ( ) ;
244-
245- new DotNetCustom ( "csi" , Path . Combine ( buildProjectDir , "Program.csx" ) )
246- . WithWorkingDirectory ( sampleProjectDir )
247- . WithShortName ( $ "Running a build as a C# script for the { sampleProjectName } ")
248- . Run ( ) . EnsureSuccess ( ) ;
249- }
250- finally
251- {
252- Directory . Delete ( buildProjectDir , true ) ;
253- }
254- }
218+ await Task . WhenAll (
219+ frameworks . Select ( framework => CheckCompatibilityAsync ( framework , packageVersion , defaultNuGetSource , outputDir ) ) ) ;
255220
256221if ( ! string . IsNullOrWhiteSpace ( apiKey ) && packageVersion . Release != "dev" && packageVersion . Release != "dev" )
257222{
290255
291256return 0 ;
292257
258+ async Task CheckCompatibilityAsync (
259+ string framework ,
260+ NuGetVersion nuGetVersion ,
261+ string nuGetSource ,
262+ string output )
263+ {
264+ var buildProjectDir = Path . Combine ( Path . GetTempPath ( ) , Guid . NewGuid ( ) . ToString ( ) [ ..4 ] ) ;
265+ Directory . CreateDirectory ( buildProjectDir ) ;
266+ var sampleProjectName = $ "sample project for { framework } ";
267+ try
268+ {
269+ var sampleProjectDir = Path . Combine ( "Samples" , "MySampleLib" , "MySampleLib.Tests" ) ;
270+ await new DotNetNew ( "build" , $ "--version={ nuGetVersion } ", "-T" , framework , "--no-restore" )
271+ . WithWorkingDirectory ( buildProjectDir )
272+ . WithShortName ( $ "Creating a new { sampleProjectName } ")
273+ . RunAsync ( ) . EnsureSuccess ( ) ;
274+
275+ await new DotNetBuild ( )
276+ . WithProject ( buildProjectDir )
277+ . WithSources ( nuGetSource , Path . Combine ( output , "CSharpInteractive" ) )
278+ . WithShortName ( $ "Building the { sampleProjectName } ")
279+ . BuildAsync ( ) . EnsureSuccess ( ) ;
280+
281+ await new DotNetRun ( )
282+ . WithProject ( buildProjectDir )
283+ . WithNoBuild ( true )
284+ . WithWorkingDirectory ( sampleProjectDir )
285+ . WithShortName ( $ "Running a build for the { sampleProjectName } ")
286+ . RunAsync ( ) . EnsureSuccess ( ) ;
287+
288+ await new DotNetCustom ( "csi" , Path . Combine ( buildProjectDir , "Program.csx" ) )
289+ . WithWorkingDirectory ( sampleProjectDir )
290+ . WithShortName ( $ "Running a build as a C# script for the { sampleProjectName } ")
291+ . RunAsync ( ) . EnsureSuccess ( ) ;
292+ }
293+ finally
294+ {
295+ Directory . Delete ( buildProjectDir , true ) ;
296+ }
297+ }
298+
293299internal record PackageInfo ( string Id , string Package , bool Publish ) ;
0 commit comments