diff --git a/Directory.Build.props b/Directory.Build.props
index 42d713f8e0d22d..9a7215424f7348 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -120,7 +120,7 @@
<_parseDistroRid>$(__DistroRid)
<_parseDistroRid Condition="'$(_parseDistroRid)' == '' and '$(MSBuildRuntimeType)' == 'core'">$([System.Runtime.InteropServices.RuntimeInformation]::RuntimeIdentifier)
<_parseDistroRid Condition="'$(_parseDistroRid)' == '' and '$(MSBuildRuntimeType)' != 'core'">win-$([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture.ToString().ToLowerInvariant)
- <_distroRidIndex>$(_parseDistroRid.LastIndexOfAny("-"))
+ <_distroRidIndex>$(_parseDistroRid.LastIndexOf('-'))
<_runtimeOS>$(RuntimeOS)
<_runtimeOS Condition="'$(_runtimeOS)' == ''">$(_parseDistroRid.SubString(0, $(_distroRidIndex)))
diff --git a/eng/SourceBuild.props b/eng/SourceBuild.props
index c9ac54d245a8bd..8db0cb0ee5c6cf 100644
--- a/eng/SourceBuild.props
+++ b/eng/SourceBuild.props
@@ -16,7 +16,7 @@
$(__DistroRid)
- <_targetRidPlatformIndex>$(TargetRid.LastIndexOfAny("-"))
+ <_targetRidPlatformIndex>$(TargetRid.LastIndexOf('-'))
$(TargetRid.Substring(0, $(_targetRidPlatformIndex)))
$(TargetRid.Substring($(_targetRidPlatformIndex)).TrimStart('-'))