clr-loader
clr-loader copied to clipboard
Add get_coreclr_command_line which uses hostfxr_initialize_for_dotnet_command_line
The problem with hostfxr_initialize_for_runtime_config
is that the trusted platform assemblies (TPA) will only contain that version's assemblies. If you reference a newer version of a runtime's assembly, the assembly load context will always load the runtime version not your referenced version. There is no way to intercept the loading of this TPA. When creating a dotnet application this does not occur as the runtime is loaded using the hostfxr_initialize_for_dotnet_command_line
method which uses the .runtimeconfig.json
and (importantly) .deps.json
. You can then continue to use the runtime as if it was loaded using hostfxr_initialize_for_runtime_config
.
See for details on different ways to initialize https://github.com/dotnet/runtime/blob/main/docs/design/features/native-hosting.md#initializing-host-context