Skip to content

Figure out if and how to load hostfxr from NativeAOT code for dotnetup and installation library #51689

@dsplaisted

Description

@dsplaisted

For dotnetup and the installer library, we use hostfxr APIs to list the installed SDKs (and will probably do so for runtimes in the future). Since hostfxr is a native library, it doesn't get packaged in a single-file NativeAOT app. So we need to figure out how to handle this.

Currently, after we install a .NET SDK, we try to load hostfxr.dll from the SDK we just installed. This works for NativeAOT, but might not work if we depend on new APIs in hostfxr that aren't present in an older SDK we are installing.

We could drop the dependency on hostfxr and implement similar functionality in managed code. That would risk behavior differences.

We could also shell out to dotnet --list-sdks or similar commands. This would likely have more overhead.

There is an existing library that implements all three of these strategies which we might be able to take advantage of: https://github.com/ericstj/dotnetlocator

A bit of prior discussion of this can be found here

Metadata

Metadata

Assignees

No one assigned

    Labels

    dotnetupWork items around the proposed `dotnetup` bootstrapper/toolchain management tool and library

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions