Events
Mar 17, 9 PM - Mar 21, 10 AM
Join the meetup series to build scalable AI solutions based on real-world use cases with fellow developers and experts.
Register nowThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
When running an application with runtime identifier (RID) specific assets, the host determines what assets are relevant for the platform on which it's running. This applies to both the application itself and the resolution logic used by AssemblyDependencyResolver.
Previously, the host tried to compute the RID at run time and then read the RID graph to determine which RID-specific assets matched or were compatible with the computed RID. Now, the default behavior doesn't compute the RID or use the RID graph. Instead, the host relies on a known list of RIDs based on how the runtime itself was built.
Previously, the process for selecting RID-specific assets was:
If the RID graph didn't have the computed RID or the fallback RID, RID assets weren't properly resolved.
By default, the process no longer relies on the RID graph. Instead, it checks for a known set of portable RIDs based on how the host was built. For example:
Linux
Windows
macOS
For non-portable builds of the host or runtime, the build might also set a non-portable RID that's checked first.
.NET 8 Preview 5
This change can affect binary compatibility and is also a behavioral change.
The RID graph was costly to maintain and understand, requiring .NET itself to be distro-aware in a fragile manner. The .NET team and the community spend a non-trivial amount of time updating the graph and backporting such updates to previous releases. The long-term goal is to stop updating the RID graph, stop reading it, and eventually remove it. This breaking change is a step towards that goal.
Use portable RIDs, for example, linux
, linux-musl
, osx
, and win
. For specialized use cases, you can use APIs like NativeLibrary.SetDllImportResolver(Assembly, DllImportResolver) or AssemblyLoadContext.ResolvingUnmanagedDll for custom loading logic.
If you need to revert to the previous behavior, set the backwards compatibility switch System.Runtime.Loader.UseRidGraph
to true
in your runtimeconfig.json file. Setting the switch to true
instructs the host to use the previous behavior of reading the RID graph. Alternatively, you can set the UseRidGraph
MSBuild property to true
in your project file. For example
<PropertyGroup>
<UseRidGraph>true</UseRidGraph>
</PropertyGroup>
.NET feedback
.NET is an open source project. Select a link to provide feedback:
Events
Mar 17, 9 PM - Mar 21, 10 AM
Join the meetup series to build scalable AI solutions based on real-world use cases with fellow developers and experts.
Register nowTraining
Module
Customize a .NET Aspire app to use existing Azure resources - Training
In this module, you'll learn how to move backing services for your Azure-hosted .NET Aspire app from containers into native Azure services.