diff --git a/src/System.CommandLine.Tests/CompilationTests.cs b/src/System.CommandLine.Tests/CompilationTests.cs index cdc4d8dff9..102088a69a 100644 --- a/src/System.CommandLine.Tests/CompilationTests.cs +++ b/src/System.CommandLine.Tests/CompilationTests.cs @@ -121,8 +121,11 @@ public void RootCommand_name_falls_back_to_the_AppContext_value_when_hosted_as_a private static string NativeLibraryFileName(string assemblyName) => OperatingSystem.IsWindows() ? $"{assemblyName}.dll" - : OperatingSystem.IsMacOS() ? $"{assemblyName}.dylib" - : $"{assemblyName}.so"; + // NativeAOT applies the "lib" prefix to native library outputs on Unix by + // default starting with the .NET 11 SDK (see dotnet/docs#52324). This repo + // pins an 11.x SDK via global.json, so the prefix is always present. + : OperatingSystem.IsMacOS() ? $"lib{assemblyName}.dylib" + : $"lib{assemblyName}.so"; [UnmanagedFunctionPointer(CallingConvention.Cdecl)] private delegate int GetExecutableNameDelegate(IntPtr buffer, int bufferLength); diff --git a/src/System.CommandLine.Tests/TestApps/NativeLibrary/NativeLibrary.csproj b/src/System.CommandLine.Tests/TestApps/NativeLibrary/NativeLibrary.csproj index 59a17bb4ad..b73b4fe124 100644 --- a/src/System.CommandLine.Tests/TestApps/NativeLibrary/NativeLibrary.csproj +++ b/src/System.CommandLine.Tests/TestApps/NativeLibrary/NativeLibrary.csproj @@ -18,6 +18,8 @@ false Guard true + + <_UseNativeLibPrefix Condition="'$(NetMinimum)' == 'net10.0'">true