Skip to content

Commit 9e02ff2

Browse files
committed
Handle consuming AcceptsRuntimeIdentifier metadata from multi-targeted projects
1 parent 02a4333 commit 9e02ff2

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,14 @@ protected override void ExecuteCore()
5555

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

58-
if (selfContainedIsGlobalProperty && project.GetBooleanMetadata("AcceptsRuntimeIdentifier") == true)
58+
bool projectAcceptsRuntimeIdentifier = false;
59+
if (projectAdditionalProperties.TryGetValue("AcceptsRuntimeIdentifier", out string acceptsRID) &&
60+
bool.TryParse(acceptsRID, out bool acceptsRIDParseResult))
61+
{
62+
projectAcceptsRuntimeIdentifier = acceptsRIDParseResult;
63+
}
64+
65+
if (selfContainedIsGlobalProperty && projectAcceptsRuntimeIdentifier)
5966
{
6067
// If AcceptsRuntimeIdentifier is true for the project, and SelfContained was set as a global property,
6168
// then the SelfContained value will flow across the project reference when we go to build it, despite the

0 commit comments

Comments
 (0)