MelonLoader icon indicating copy to clipboard operation
MelonLoader copied to clipboard

[Enhancement]: Issues running Windows game on Linux with dotnet installed on Linux

Open samr7 opened this issue 5 months ago • 0 comments

Describe the new feature or enhancement

I followed the instructions for how to install MelonLoader v0.6.4 for a Windows game running under Steam Proton on Linux.

I had some problems, and would like to share my solution.

The main problem is that it failed to load hostfxr:

[ERROR] il2cpp_init detour failed: Failed to load hostfxr. Please make sure you have installed the .NET 6.0 runtime.

I definitely had the dotnetdesktop6 package installed per the instructions.

It turned out that it was failing because the Linux dotnet SDK was installed on the host, and it configures a system-wide environment variable, DOTNET_ROOT. This environment variable was being passed into the Proton Windows environment. The Windows dotnet host tool also uses this environment variable, and having it set, especially to a Linux host path, prevented it from finding its runtime.

In Steam, this environment variable can be cleared by setting launch options for the game:

DOTNET_ROOT= %command%

I don't think this should be fixed/enhanced in MelonLoader itself, but maybe it would help somebody else if it got into the instructions.

samr7 avatar Sep 10 '24 19:09 samr7