@@ -381,26 +381,25 @@ public void SelfContainedExecutableCannotBeReferencedByNonSelfContainedMTPTestPr
381
381
SelfContained = "true" ,
382
382
} ;
383
383
384
- var testAssetSelfContained = _testAssetsManager . CreateTestProject ( testConsoleProjectSelfContained ) ;
385
-
386
384
var mtpNotSelfContained = new TestProject ( "MTPTestProject" )
387
385
{
388
386
TargetFrameworks = ToolsetInfo . CurrentTargetFramework ,
389
387
IsExe = true ,
390
- IsTestProject = true ,
391
388
} ;
392
389
390
+ mtpNotSelfContained . AdditionalProperties [ "IsTestProject" ] = "true" ;
391
+
393
392
if ( setIsTestingPlatformApplicationEarly )
394
393
{
395
- mtpNotSelfContained . IsTestingPlatformApplication = true ;
394
+ mtpNotSelfContained . AdditionalProperties [ " IsTestingPlatformApplication" ] = " true" ;
396
395
}
397
396
397
+ mtpNotSelfContained . ReferencedProjects . Add ( testConsoleProjectSelfContained ) ;
398
+
398
399
var testAssetMTP = _testAssetsManager . CreateTestProject ( mtpNotSelfContained ) ;
399
400
400
401
var mtpProjectDirectory = Path . Combine ( testAssetMTP . Path , "MTPTestProject" ) ;
401
- Assert . True ( Directory . Exists ( mtpProjectDirectory ) , $ "Expected directory { mtpProjectDirectory } to exist.") ;
402
- Assert . True ( File . Exists ( Path . Combine ( mtpProjectDirectory , "MTPTestProject.csproj" ) ) , $ "Expected file MTPTestProject.csproj to exist in { mtpProjectDirectory } .") ;
403
-
402
+
404
403
if ( ! setIsTestingPlatformApplicationEarly )
405
404
{
406
405
File . WriteAllText ( Path . Combine ( mtpProjectDirectory , "Directory.Build.targets" ) , """
@@ -412,12 +411,6 @@ public void SelfContainedExecutableCannotBeReferencedByNonSelfContainedMTPTestPr
412
411
""" ) ;
413
412
}
414
413
415
- new DotnetCommand ( Log , "add" , "reference" , Path . Combine ( testAssetSelfContained . Path , testConsoleProjectSelfContained . Name ) )
416
- . WithWorkingDirectory ( mtpProjectDirectory )
417
- . Execute ( )
418
- . Should ( )
419
- . Pass ( ) ;
420
-
421
414
var result = new BuildCommand ( Log , mtpProjectDirectory ) . Execute ( ) ;
422
415
result . Should ( ) . HaveStdOutContaining ( "NETSDK1151" ) . And . ExitWith ( 1 ) ;
423
416
}
@@ -437,29 +430,26 @@ public void MTPNonSelfContainedExecutableCannotBeReferencedBySelfContained(bool
437
430
SelfContained = "true" ,
438
431
} ;
439
432
440
- var testAssetSelfContained = _testAssetsManager . CreateTestProject ( testConsoleProjectSelfContained ) ;
441
-
442
433
var mtpNotSelfContained = new TestProject ( "MTPTestProject" )
443
434
{
444
435
TargetFrameworks = ToolsetInfo . CurrentTargetFramework ,
445
436
IsExe = true ,
446
- IsTestProject = true ,
447
437
} ;
448
438
439
+ mtpNotSelfContained . AdditionalProperties [ "IsTestProject" ] = "true" ;
440
+
449
441
if ( setIsTestingPlatformApplicationEarly )
450
442
{
451
- mtpNotSelfContained . IsTestingPlatformApplication = true ;
443
+ mtpNotSelfContained . AdditionalProperties [ " IsTestingPlatformApplication" ] = " true" ;
452
444
}
453
445
454
- var testAssetMTP = _testAssetsManager . CreateTestProject ( mtpNotSelfContained ) ;
455
-
456
- var mtpProjectDirectory = Path . Combine ( testAssetMTP . Path , mtpNotSelfContained . Name ) ;
457
- Assert . True ( Directory . Exists ( mtpProjectDirectory ) , $ "Expected directory { mtpProjectDirectory } to exist.") ;
458
- Assert . True ( File . Exists ( Path . Combine ( mtpProjectDirectory , "MTPTestProject.csproj" ) ) , $ "Expected file MTPTestProject.csproj to exist in { mtpProjectDirectory } .") ;
446
+ testConsoleProjectSelfContained . ReferencedProjects . Add ( mtpNotSelfContained ) ;
459
447
448
+ var testAssetSelfContained = _testAssetsManager . CreateTestProject ( testConsoleProjectSelfContained ) ;
449
+
460
450
if ( ! setIsTestingPlatformApplicationEarly )
461
451
{
462
- File . WriteAllText ( Path . Combine ( mtpProjectDirectory , "Directory.Build.targets" ) , """
452
+ File . WriteAllText ( Path . Combine ( testAssetSelfContained . TestRoot , mtpNotSelfContained . Name , "Directory.Build.targets" ) , """
463
453
<Project>
464
454
<PropertyGroup>
465
455
<IsTestingPlatformApplication>true</IsTestingPlatformApplication>
@@ -469,14 +459,6 @@ public void MTPNonSelfContainedExecutableCannotBeReferencedBySelfContained(bool
469
459
}
470
460
471
461
var consoleAppDirectory = Path . Combine ( testAssetSelfContained . Path , testConsoleProjectSelfContained . Name ) ;
472
- Assert . True ( Directory . Exists ( consoleAppDirectory ) , $ "Expected directory { consoleAppDirectory } to exist.") ;
473
- Assert . True ( File . Exists ( Path . Combine ( consoleAppDirectory , "ConsoleApp.csproj" ) ) , $ "Expected file ConsoleApp.csproj to exist in { consoleAppDirectory } .") ;
474
-
475
- new DotnetCommand ( Log , "add" , "reference" , Path . Combine ( testAssetMTP . Path , mtpNotSelfContained . Name ) )
476
- . WithWorkingDirectory ( consoleAppDirectory )
477
- . Execute ( )
478
- . Should ( )
479
- . Pass ( ) ;
480
462
481
463
var result = new BuildCommand ( Log , consoleAppDirectory ) . Execute ( ) ;
482
464
result . Should ( ) . HaveStdOutContaining ( "NETSDK1150" ) . And . ExitWith ( 1 ) ;
@@ -534,20 +516,19 @@ public void MTPCanBeBuiltAsSelfContained(bool setIsTestingPlatformApplicationEar
534
516
{
535
517
TargetFrameworks = ToolsetInfo . CurrentTargetFramework ,
536
518
IsExe = true ,
537
- IsTestProject = true ,
538
519
SelfContained = "true" ,
539
520
} ;
540
521
522
+ mtpSelfContained . AdditionalProperties [ "IsTestProject" ] = "true" ;
523
+
541
524
if ( setIsTestingPlatformApplicationEarly )
542
525
{
543
- mtpSelfContained . IsTestingPlatformApplication = true ;
526
+ mtpSelfContained . AdditionalProperties [ " IsTestingPlatformApplication" ] = " true" ;
544
527
}
545
528
546
529
var testAssetMTP = _testAssetsManager . CreateTestProject ( mtpSelfContained ) ;
547
530
548
531
var mtpProjectDirectory = Path . Combine ( testAssetMTP . Path , mtpSelfContained . Name ) ;
549
- Assert . True ( Directory . Exists ( mtpProjectDirectory ) , $ "Expected directory { mtpProjectDirectory } to exist.") ;
550
- Assert . True ( File . Exists ( Path . Combine ( mtpProjectDirectory , "MTPTestProject.csproj" ) ) , $ "Expected file MTPTestProject.csproj to exist in { mtpProjectDirectory } .") ;
551
532
552
533
if ( ! setIsTestingPlatformApplicationEarly )
553
534
{
0 commit comments