Skip to content

Commit 5c9fe7d

Browse files
[RuntimeInteference.targets] add property to opt out of R2R error message (#48624)
Context: #36047 Context: dotnet/android#10062 We have experimental support for CoreCLR+R2R on Android. Android is also unique in that a default build can target multiple RIDs via: <RuntimeIdentifiers>android-arm;android-arm64;android-x86;android-x64</RuntimeIdentifiers> Unfortunately, targeting 4 RIDs like this results in: dotnet/sdk/10.0.100-preview.4.25180.3/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.RuntimeIdentifierInference.targets(219,5): error NETSDK1191: A runtime identifier for the property 'PublishReadyToRun' couldn't be inferred. Specify a rid explicitly But simply skipping this error message allows the build to succeed, and R2R successfully runs on all 4 RIDs. Just like in d21e6bf, I introduced a new `$(AllowReadyToRunWithoutRuntimeIdentifier)` property to opt out of this error message. I also added `$(AllowPublishSingleFileWithoutRuntimeIdentifier)`, to give the same flexibility in the future.
1 parent 73c5c5b commit 5c9fe7d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,11 +216,11 @@ Copyright (c) .NET Foundation. All rights reserved.
216216
ResourceName="ImplicitRuntimeIdentifierResolutionForPublishPropertyFailed"
217217
FormatArguments="SelfContained"/>
218218

219-
<NETSdkError Condition="'$(PublishReadyToRun)' == 'true' and '$(RuntimeIdentifier)' == '' and '$(_IsPublishing)' == 'true'"
219+
<NETSdkError Condition="'$(PublishReadyToRun)' == 'true' and '$(RuntimeIdentifier)' == '' and '$(_IsPublishing)' == 'true' and '$(AllowReadyToRunWithoutRuntimeIdentifier)' != 'true'"
220220
ResourceName="ImplicitRuntimeIdentifierResolutionForPublishPropertyFailed"
221221
FormatArguments="PublishReadyToRun"/>
222222

223-
<NETSdkError Condition="'$(PublishSingleFile)' == 'true' and '$(RuntimeIdentifier)' == '' and '$(_IsPublishing)' == 'true'"
223+
<NETSdkError Condition="'$(PublishSingleFile)' == 'true' and '$(RuntimeIdentifier)' == '' and '$(_IsPublishing)' == 'true' and '$(AllowPublishSingleFileWithoutRuntimeIdentifier)' != 'true'"
224224
ResourceName="ImplicitRuntimeIdentifierResolutionForPublishPropertyFailed"
225225
FormatArguments="PublishSingleFile"/>
226226

0 commit comments

Comments
 (0)