-
Notifications
You must be signed in to change notification settings - Fork 6.1k
[Breaking change]: .NET Linux applications do not look in netcoredeps sub-directory for native libraries
#45778
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 6 commits
c746330
c3d1160
4210233
60ecaba
99340b6
7249576
2ee0bc7
2f57437
b54e1c7
1c569cf
dc0dc5a
e7c760e
30c2aa3
c4482f8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| --- | ||
| title: "Breaking change - Linux native library resolution no longer uses `netcoredeps`" | ||
| description: "Learn about the breaking change in .NET 8 where Linux applications no longer search the `netcoredeps` subdirectory for native libraries." | ||
| ms.date: 4/10/2025 | ||
| ai-usage: ai-assisted | ||
| ms.custom: https://github.com/dotnet/docs/issues/45777 | ||
| --- | ||
|
|
||
| # Linux native library resolution no longer uses `netcoredeps` | ||
|
|
||
| Starting in .NET 8, Linux applications no longer search the `netcoredeps` subdirectory for native libraries. | ||
|
|
||
| ## Version introduced | ||
|
|
||
| .NET 8 | ||
|
|
||
| ## Previous behavior | ||
|
|
||
| In earlier versions of .NET, Linux applications searched for native libraries in a `netcoredeps` subdirectory located next to the application executable. This behavior applied to all native library loads, including user-defined platform invokes (p/invokes). | ||
|
|
||
| ## New behavior | ||
|
|
||
| In .NET 8 and later, Linux applications no longer search the `netcoredeps` subdirectory for native libraries. Native library resolution now follows standard mechanisms without relying on this subdirectory. | ||
|
|
||
| ## Type of breaking change | ||
|
|
||
| This is a [source incompatible](../../categories.md#source-compatibility) change. | ||
|
|
||
| ## Reason for change | ||
|
|
||
| The `netcoredeps` behavior was originally introduced to handle complex dependencies on third-party libraries in earlier .NET versions. .NET 8+ no longer requires this behavior due to improved dependency handling. Additionally, the mechanism isn't aligned with recommended practices for ELF platforms. | ||
|
|
||
| For more information, see [GitHub issue #114393](https://github.com/dotnet/runtime/issues/114393). | ||
|
|
||
| ## Recommended action | ||
|
|
||
| If your application relied on the `netcoredeps` subdirectory for p/invokes or custom native library resolution, use the following alternatives: | ||
|
|
||
| - Implement a custom resolution mechanism using one of the following: | ||
| - <xref:System.Runtime.Loader.AssemblyLoadContext.ResolvingUnmanagedDll> | ||
|
Check failure on line 40 in docs/core/compatibility/interop/8.0/linux-netcoredeps.md
|
||
CamSoper marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| - <xref:System.Runtime.InteropServices.NativeLibrary.SetDllImportResolver> | ||
|
Check failure on line 41 in docs/core/compatibility/interop/8.0/linux-netcoredeps.md
|
||
| - <xref:System.Runtime.InteropServices.NativeLibrary.Load> | ||
|
Check failure on line 42 in docs/core/compatibility/interop/8.0/linux-netcoredeps.md
|
||
| - <xref:System.Runtime.InteropServices.NativeLibrary.SetDllImportResolver> | ||
|
Check failure on line 43 in docs/core/compatibility/interop/8.0/linux-netcoredeps.md
|
||
CamSoper marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| - If an `RPATH` is required in your deployment, modify the ELF file explicitly using the `patchelf` utility. | ||
|
|
||
| ## Affected APIs | ||
|
|
||
| - `DllImport` | ||
| - <xref:System.Runtime.InteropServices.NativeLibrary.Load*?displayProperty=fullName> | ||
Uh oh!
There was an error while loading. Please reload this page.