Skip to content

Commit

Permalink
[workload] Fix using empty RuntimeIdentifier in LibraryBuilder AutoIm…
Browse files Browse the repository at this point in the history
…port.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.
  • Loading branch information
steveisok committed Mar 28, 2023
1 parent 3231e4f commit dbea6d7
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!-- Licensed to the .NET Foundation under one or more agreements. The .NET Foundation licenses this file to you under the MIT license. -->
<Project>
<PropertyGroup>
<TargetOS>$(RuntimeIdentifier.Substring(0, $(RuntimeIdentifier.IndexOf('-'))))</TargetOS>
<TargetOS Condition="'$(RuntimeIdentifier)' != '' and $(RuntimeIdentifier.Contains('-'))">$(RuntimeIdentifier.Substring(0, $(RuntimeIdentifier.IndexOf('-'))))</TargetOS>

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

0 comments on commit dbea6d7

Please sign in to comment.