Skip to content

Commit 2e1556e

Browse files
committed
Use IsRidAgnostic instead of AcceptsRuntimeIdentifier
1 parent 117a1c9 commit 2e1556e

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed

src/Tasks/Microsoft.NET.Build.Tasks/ValidateExecutableReferences.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,16 +55,16 @@ protected override void ExecuteCore()
5555

5656
bool selfContainedIsGlobalProperty = BuildEngine6.GetGlobalProperties().ContainsKey("SelfContained");
5757

58-
bool projectAcceptsRuntimeIdentifier = false;
59-
if (projectAdditionalProperties.TryGetValue("AcceptsRuntimeIdentifier", out string acceptsRID) &&
60-
bool.TryParse(acceptsRID, out bool acceptsRIDParseResult))
58+
bool projectIsRidAgnostic = true;
59+
if (projectAdditionalProperties.TryGetValue("IsRidAgnostic", out string isRidAgnostic) &&
60+
bool.TryParse(isRidAgnostic, out bool isRidAgnosticParseResult))
6161
{
62-
projectAcceptsRuntimeIdentifier = acceptsRIDParseResult;
62+
projectIsRidAgnostic = isRidAgnosticParseResult;
6363
}
6464

65-
if (selfContainedIsGlobalProperty && projectAcceptsRuntimeIdentifier)
65+
if (selfContainedIsGlobalProperty && !projectIsRidAgnostic)
6666
{
67-
// If AcceptsRuntimeIdentifier is true for the project, and SelfContained was set as a global property,
67+
// If a project is NOT RID agnostic, and SelfContained was set as a global property,
6868
// then the SelfContained value will flow across the project reference when we go to build it, despite the
6969
// fact that we ignored it when doing the GetTargetFrameworks negotiation.
7070
referencedProjectIsSelfContained = SelfContained;

src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.Sdk.targets

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,13 @@ Copyright (c) .NET Foundation. All rights reserved.
7979
<PredefinedCulturesOnly Condition="'$(PredefinedCulturesOnly)' == '' and '$(InvariantGlobalization)' == 'true'">true</PredefinedCulturesOnly>
8080
</PropertyGroup>
8181

82-
<!-- Set the AcceptsRuntimeIdentifier property if this project should accept global RuntimeIdentifier and SelfContained
82+
<!-- Set the IsRidAgnostic property if this project should NOT accept global RuntimeIdentifier and SelfContained
8383
property values from referencing projects. -->
84-
<PropertyGroup Condition="'$(AcceptsRuntimeIdentifier)' == '' And '$(IsTestProject)' != 'true'">
85-
<AcceptsRuntimeIdentifier Condition="'$(_IsExecutable)' == 'true' Or
86-
'$(RuntimeIdentifier)' != '' Or
87-
'$(RuntimeIdentifiers)' != ''">true</AcceptsRuntimeIdentifier>
84+
<PropertyGroup Condition="'$(IsRidAgnostic)' == ''">
85+
<IsRidAgnostic Condition="('$(_IsExecutable)' == 'true' And '$(IsTestProject)' != 'true') Or
86+
'$(RuntimeIdentifier)' != '' Or
87+
'$(RuntimeIdentifiers)' != ''">false</IsRidAgnostic>
88+
<IsRidAgnostic Condition="'$(IsRidAgnostic)' == ''">true</IsRidAgnostic>
8889
</PropertyGroup>
8990

9091
<!-- Opt into .NET Core resource-serialization strategy by default when targeting frameworks
@@ -1077,6 +1078,7 @@ Copyright (c) .NET Foundation. All rights reserved.
10771078
<ItemGroup>
10781079
<AdditionalTargetFrameworkInfoProperty Include="SelfContained"/>
10791080
<AdditionalTargetFrameworkInfoProperty Include="_IsExecutable"/>
1081+
<AdditionalTargetFrameworkInfoProperty Include="IsRidAgnostic"/>
10801082
<AdditionalTargetFrameworkInfoProperty Include="ShouldBeValidatedAsExecutableReference"/>
10811083
</ItemGroup>
10821084

0 commit comments

Comments
 (0)