@@ -115,7 +115,7 @@ 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' And '$(IsTestProject)' != 'true' ) Or
118
+ <IsRidAgnostic Condition =" ('$(_IsExecutable)' == 'true') Or
119
119
'$(RuntimeIdentifier)' != '' Or
120
120
'$(RuntimeIdentifiers)' != ''" >false</IsRidAgnostic >
121
121
<IsRidAgnostic Condition =" '$(IsRidAgnostic)' == ''" >true</IsRidAgnostic >
@@ -1292,27 +1292,28 @@ Copyright (c) .NET Foundation. All rights reserved.
1292
1292
<ShouldBeValidatedAsExecutableReference >false</ShouldBeValidatedAsExecutableReference >
1293
1293
</PropertyGroup >
1294
1294
1295
- <PropertyGroup Condition =" '$(IsTestProject)' == 'true' And '$(ValidateExecutableReferencesMatchSelfContained)' == ''" >
1296
- <!-- Don't generate an error if a test project references a self-contained Exe. Test projects
1297
- use an OutputType of Exe but will usually call APIs in a referenced Exe rather than try
1298
- to run it. -->
1299
- <ValidateExecutableReferencesMatchSelfContained >false</ValidateExecutableReferencesMatchSelfContained >
1300
- </PropertyGroup >
1301
-
1302
- <PropertyGroup Condition =" '$(IsTestProject)' == 'true'" >
1303
- <!-- Don't generate an error if an Exe project references a test project. -->
1304
- <ShouldBeValidatedAsExecutableReference >false</ShouldBeValidatedAsExecutableReference >
1305
- </PropertyGroup >
1306
-
1307
-
1308
1295
<UsingTask TaskName =" ValidateExecutableReferences" AssemblyFile =" $(MicrosoftNETBuildTasksAssembly)" />
1309
1296
1310
1297
<PropertyGroup >
1311
1298
<_UseAttributeForTargetFrameworkInfoPropertyNames Condition =" $([MSBuild]::VersionGreaterThanOrEquals($(MSBuildVersion), '17.0'))" >true</_UseAttributeForTargetFrameworkInfoPropertyNames >
1312
1299
</PropertyGroup >
1313
1300
1301
+ <Target Name =" _CalculateIsVSTest" >
1302
+ <PropertyGroup >
1303
+ <_IsVSTest Condition =" '$(IsTestProject)' == 'true' and '$(IsTestingPlatformApplication)' != 'true'" >true</_IsVSTest >
1304
+ <_IsVSTest Condition =" '$(_IsVSTest)' == ''" >false</_IsVSTest >
1305
+
1306
+ <!-- Don't generate an error if an Exe project references a test project. -->
1307
+ <ShouldBeValidatedAsExecutableReference Condition =" '$(_IsVSTest)' == 'true'" >false</ShouldBeValidatedAsExecutableReference >
1308
+
1309
+ <!-- Don't generate an error if a test project references a self-contained Exe. Test projects
1310
+ use an OutputType of Exe but will usually call APIs in a referenced Exe rather than try
1311
+ to run it. -->
1312
+ <ValidateExecutableReferencesMatchSelfContained Condition =" '$(_IsVSTest)' == 'true' And '$(ValidateExecutableReferencesMatchSelfContained)' == ''" >false</ValidateExecutableReferencesMatchSelfContained >
1313
+ </PropertyGroup >
1314
+ </Target >
1315
+
1314
1316
<Target Name =" ValidateExecutableReferences"
1315
- AfterTargets =" _GetProjectReferenceTargetFrameworkProperties"
1316
1317
Condition =" '$(ValidateExecutableReferencesMatchSelfContained)' != 'false'" >
1317
1318
1318
1319
<ValidateExecutableReferences
@@ -1322,6 +1323,12 @@ Copyright (c) .NET Foundation. All rights reserved.
1322
1323
UseAttributeForTargetFrameworkInfoPropertyNames =" $(_UseAttributeForTargetFrameworkInfoPropertyNames)" />
1323
1324
</Target >
1324
1325
1326
+ <Target Name =" ValidateExecutableReferencesCore"
1327
+ DependsOnTargets =" _CalculateIsVSTest;ValidateExecutableReferences"
1328
+ AfterTargets =" _GetProjectReferenceTargetFrameworkProperties" >
1329
+
1330
+ </Target >
1331
+
1325
1332
<!--
1326
1333
============================================================
1327
1334
Command Line Configuration Validation
0 commit comments