diff --git a/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.targets b/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.targets
index 6f0920d555c4c..2ead5803e5cea 100644
--- a/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.targets
+++ b/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.targets
@@ -335,7 +335,8 @@ The .NET Foundation licenses this file to you under the MIT license.
<_IgnoreLinkerWarnings>false
<_IgnoreLinkerWarnings Condition="'$(_IsApplePlatform)' == 'true'">true
- -x
+ <_StripFlag Condition="'$(_IsApplePlatform)' == 'true' and '$(NativeLib)' == 'Shared'">-x
+ <_StripFlag Condition="'$(_IsApplePlatform)' == 'true' and '$(NativeLib)' != 'Shared' and '$(IlcExportUnmanagedEntrypoints)' == 'true'">-i -s $(ExportsFile)
@@ -362,7 +363,7 @@ The .NET Foundation licenses this file to you under the MIT license.
+ strip -no_code_signature_warning $(_StripFlag) "$(NativeBinary)"" />
BuildAndRun
true
true
-
-
- false