How to locate dotnet

How to locate dotnet from the currently running .NET Core application

I've seen a bunch of DotNetMuxer implementations, but they all look quite similar (if not exactly the same).

Seems like there are two approaches: those that try to locate a FX_DEPS_FILE file and those that just use the current process' MainModule (which would be dotnet[.exe] itself for a .NET Core app. The latter looks simpler and the former seems unnecessary, until you take into account self-contained .NET Core apps or even trimmed self-contained, but even that version doesn't work in those cases :(

Last updated