Skip to content

[Breaking change]: NativeAOT: Use lib prefix by default on Unix for native library outputs #52324

Closed

Description

@sbomer

[Breaking change]: NativeAOT uses lib prefix by default for native library outputs on Unix

Description

Starting in .NET 11 Preview 3, NativeAOT now applies the lib prefix (e.g., libfoo.so, libfoo.dylib, libfoo.a) by default to non-executable native library outputs on Unix platforms. This aligns with standard Unix naming conventions for shared and static libraries. Previously, the lib prefix was not applied by default.

This change introduces a new public property, UseNativeLibPrefix, which allows developers to opt out of the default behavior. By default, the lib prefix is applied unless UseNativeLibPrefix is explicitly set to false.

Version

.NET 11 Preview 3

Previous behavior

On Unix platforms, NativeAOT did not apply the lib prefix to native library outputs. For example:

  • A shared library output would be named foo.so instead of libfoo.so.
  • A static library output would be named foo.a instead of libfoo.a.

New behavior

NativeAOT now applies the lib prefix by default to non-executable native library outputs on Unix platforms. For example:

  • A shared library output is now named libfoo.so instead of foo.so.
  • A static library output is now named libfoo.a instead of foo.a.

Developers can opt out of this behavior by setting the new public UseNativeLibPrefix property to false in their project file:

<PropertyGroup>
  <UseNativeLibPrefix>false</UseNativeLibPrefix>
</PropertyGroup>

Type of breaking change

  • Behavioral change: Existing binaries might behave differently at runtime due to the change in naming conventions for native library outputs.

Reason for change

The lib prefix is a widely accepted naming convention for shared and static libraries on Unix platforms. This change improves consistency and interoperability with other Unix-based tools and systems. It also simplifies the configuration process by making the lib prefix the default behavior, reducing the need for workarounds in .NET for Android, which requires binaries to follow this naming convention.

Recommended action

Developers targeting Unix platforms with NativeAOT should review their build outputs and update any scripts, deployment processes, or configurations that depend on the previous naming conventions. Specifically:

  1. Update scripts and tools: If your build or deployment scripts reference native library outputs by name, ensure they account for the new lib prefix.
  2. Opt out if necessary: If the lib prefix causes issues in your workflow, set the UseNativeLibPrefix property to false in your project file to revert to the previous behavior.

For example, to disable the lib prefix:

<PropertyGroup>
  <UseNativeLibPrefix>false</UseNativeLibPrefix>
</PropertyGroup>

Feature area

  • NativeAOT-coreclr

Affected APIs

This change does not directly affect public APIs but introduces the following new MSBuild property:

  • UseNativeLibPrefix (public property)

Additional information

For more details, see the original pull request: NativeAOT: Use lib prefix by default on Unix for native library outputs.


Associated WorkItem - 562234

Activity

  1. added
    breaking-change
    on Mar 16, 2026
  2. self-assigned this
    on Mar 16, 2026
  3. added
    🗺️ mapQUEST
    on Mar 16, 2026
  4. added
    🗺️ reQUEST
    on Mar 16, 2026
  5. removed
    🗺️ mapQUEST
    ⌚ Not Triaged
    on Mar 16, 2026
  6. added
    📌 seQUESTered
    and removed
    🗺️ reQUEST
    on Mar 17, 2026
  7. added
    🗺️ mapQUEST
    on Apr 1, 2026
  8. removed
    🗺️ mapQUEST
    on Apr 1, 2026
  9. moved this from 🔖 Ready to 🏗 In progress in dotnet/docs April 2026 sprinton Apr 3, 2026
  10. added
    🗺️ mapQUEST
    on Apr 3, 2026
  11. removed
    🗺️ mapQUEST
    on Apr 3, 2026
  12. added a commit that references this issue on Apr 3, 2026
    3ea1f4c
  13. moved this from 🏗 In progress to 👀 In review in dotnet/docs April 2026 sprinton Apr 4, 2026
  14. moved this from 👀 In review to ✅ Done in dotnet/docs April 2026 sprinton Apr 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

📌 seQUESTeredbreaking-change

Type

No type

Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions