Skip to content

Commit dbea6d7

Browse files
authored
[workload] Fix using empty RuntimeIdentifier in LibraryBuilder AutoImport.props (#83834)
When `mobile-librarybuilder-experimental` is installed, the LibraryBuilder SDK AutoImport.props activates and it incorrectly tries to IndexOf RuntimeIdentifier even when it's an empty string. This can lead to annoying error messages popping up even when not using the workload. The fix is to add a condition only when RuntimeIdentifier has a value.
1 parent 3231e4f commit dbea6d7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/mono/nuget/Microsoft.NET.Runtime.LibraryBuilder.Sdk/Sdk/AutoImport.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<!-- Licensed to the .NET Foundation under one or more agreements. The .NET Foundation licenses this file to you under the MIT license. -->
22
<Project>
33
<PropertyGroup>
4-
<TargetOS>$(RuntimeIdentifier.Substring(0, $(RuntimeIdentifier.IndexOf('-'))))</TargetOS>
4+
<TargetOS Condition="'$(RuntimeIdentifier)' != '' and $(RuntimeIdentifier.Contains('-'))">$(RuntimeIdentifier.Substring(0, $(RuntimeIdentifier.IndexOf('-'))))</TargetOS>
55

66
<TargetsAppleMobile Condition="'$(TargetOS)' == 'ios' or '$(TargetOS)' == 'iossimulator' or '$(TargetOS)' == 'maccatalyst' or '$(TargetOS)' == 'tvos' or '$(TargetOS)' == 'tvossimulator'">true</TargetsAppleMobile>
77
<TargetsAndroid Condition="'$(TargetOS)' == 'android'">true</TargetsAndroid>

0 commit comments

Comments
 (0)