@@ -294,30 +294,37 @@ Task("Test")
294294 . IsDependentOn ( "PrepareTestAssets" )
295295 . Does ( ( ) =>
296296{
297- var testTargetFramework = useDotNetTest ? "net8 .0" : "net472" ;
297+ var testTargetFramework = useDotNetTest ? "net10 .0" : "net472" ;
298298 var testProjects = string . IsNullOrEmpty ( testProjectArgument ) ? buildPlan . TestProjects : testProjectArgument . Split ( ',' ) ;
299+ var environment = new Dictionary < string , string > ( ) ;
300+
301+ if ( ! useDotNetTest && Platform . Current . IsWindows )
302+ {
303+ environment . Add ( "DOTNET_PATH" , env . Folders . DotNetSdk ) ;
304+ }
305+
299306 foreach ( var testProject in testProjects )
300307 {
301308 PrintBlankLine ( ) ;
302309 var instanceFolder = CombinePaths ( env . Folders . Bin , configuration , testProject , testTargetFramework ) ;
303310 var targetPath = CombinePaths ( instanceFolder , $ "{ testProject } .dll") ;
304311
305- if ( useDotNetTest )
312+ if ( useDotNetTest || Platform . Current . IsWindows )
306313 {
307314 var logFile = CombinePaths ( env . Folders . ArtifactsLogs , $ "{ testProject } -netsdk-result.xml") ;
308315 var arguments = $ "test \" { targetPath } \" --logger \" console;verbosity=normal\" --logger \" trx;LogFileName={ logFile } \" --blame-hang-timeout 60sec";
309316
310317 Console . WriteLine ( $ "Executing: dotnet { arguments } ") ;
311318
312- Run ( "dotnet" , arguments , instanceFolder )
319+ Run ( "dotnet" , arguments , new RunOptions ( workingDirectory : instanceFolder , environment : environment ) )
313320 . ExceptionOnError ( $ "Test { testProject } failed for { testTargetFramework } ") ;
314321 }
315322 else
316323 {
317324 var logFile = CombinePaths ( env . Folders . ArtifactsLogs , $ "{ testProject } -desktop-result.xml") ;
318325
319326 // Copy xunit executable to test folder to solve path errors
320- var xunitToolsFolder = CombinePaths ( env . Folders . Tools , "xunit.runner.console" , "tools" , "net452 " ) ;
327+ var xunitToolsFolder = CombinePaths ( env . Folders . Tools , "xunit.runner.console" , "tools" , "net472 " ) ;
321328 var xunitInstancePath = CombinePaths ( instanceFolder , "xunit.console.exe" ) ;
322329 FileHelper . Copy ( CombinePaths ( xunitToolsFolder , "xunit.console.exe" ) , xunitInstancePath , overwrite : true ) ;
323330 FileHelper . Copy ( CombinePaths ( xunitToolsFolder , "xunit.runner.utility.net452.dll" ) , CombinePaths ( instanceFolder , "xunit.runner.utility.net452.dll" ) , overwrite : true ) ;
0 commit comments