File tree Expand file tree Collapse file tree 2 files changed +21
-6
lines changed
src/Tasks/Microsoft.NET.Build.Tasks/targets
test/Microsoft.NET.Build.Tests Expand file tree Collapse file tree 2 files changed +21
-6
lines changed Original file line number Diff line number Diff line change @@ -115,7 +115,10 @@ Copyright (c) .NET Foundation. All rights reserved.
115
115
<!-- Set the IsRidAgnostic property if this project should NOT accept global RuntimeIdentifier and SelfContained
116
116
property values from referencing projects. -->
117
117
<PropertyGroup Condition =" '$(IsRidAgnostic)' == ''" >
118
- <IsRidAgnostic Condition =" ('$(_IsExecutable)' == 'true') Or
118
+ <!-- It's preferred to read IsTestingPlatformApplication in an actual MSBuild target and not in evaluation, but it's best we can do here -->
119
+ <!-- NOTE: A VSTest non-MTP test project will have IsTestProject=true AND IsTestingPlatformApplication!=true -->
120
+ <!-- We want to make VSTest non-MTP test project to be rid agnostic because it doesn't really produce a runnable executable -->
121
+ <IsRidAgnostic Condition =" ('$(_IsExecutable)' == 'true' And ('$(IsTestProject)' != 'true' Or '$(IsTestingPlatformApplication)' == 'true')) Or
119
122
'$(RuntimeIdentifier)' != '' Or
120
123
'$(RuntimeIdentifiers)' != ''" >false</IsRidAgnostic >
121
124
<IsRidAgnostic Condition =" '$(IsRidAgnostic)' == ''" >true</IsRidAgnostic >
Original file line number Diff line number Diff line change @@ -468,7 +468,8 @@ public void MTPNonSelfContainedExecutableCannotBeReferencedBySelfContained(bool
468
468
[ CombinatorialData ]
469
469
public void ExeProjectCanReferenceTestProject (
470
470
[ CombinatorialValues ( "xunit" , "mstest" ) ] string testTemplateName ,
471
- bool setSelfContainedProperty )
471
+ bool setSelfContainedProperty ,
472
+ bool buildWithSelfContainedFromCommandLine )
472
473
{
473
474
var testConsoleProject = new TestProject ( "ConsoleApp" )
474
475
{
@@ -502,10 +503,21 @@ public void ExeProjectCanReferenceTestProject(
502
503
. Should ( )
503
504
. Pass ( ) ;
504
505
505
- new BuildCommand ( Log , consoleProjectDirectory )
506
- . Execute ( )
507
- . Should ( )
508
- . Pass ( ) ;
506
+ if ( buildWithSelfContainedFromCommandLine )
507
+ {
508
+ new DotnetCommand ( Log , "build" , "--self-contained" )
509
+ . WithWorkingDirectory ( consoleProjectDirectory )
510
+ . Execute ( )
511
+ . Should ( )
512
+ . Pass ( ) ;
513
+ }
514
+ else
515
+ {
516
+ new BuildCommand ( Log , consoleProjectDirectory )
517
+ . Execute ( )
518
+ . Should ( )
519
+ . Pass ( ) ;
520
+ }
509
521
}
510
522
511
523
[ Theory ]
You can’t perform that action at this time.
0 commit comments