Failed to load hostfxr.dll


I'm working on an installer for an application that deploys an ASP.Net Core 2 website on IIS. I have run into a unique issue with Windows 7 where I get the following error:

Failed to load the dll from [C:\Program Files (x86)\dotnet\host\fxr\2.1.2\hostfxr.dll], HRESULT: 0x80070057 The library hostfxr.dll was found, but loading it from C:\Program Files (x86)\dotnet\host\fxr\2.1.2\hostfxr.dll failed - Installing .NET Core prerequisites might help resolve this problem.

Here are some important things to note:

My website fails to load, giving me a 500.19 error. In my development of my installer, I've found that this typically means I'm missing some Windows Features, but in this case it seems to be giving me another error.

So, the next thing I try in the situation is to manually run my website with dotnet.exe. So I'll run the following command in an elevated command prompt:

"C:\Program Files (x86)\dotnet\dotnet.exe" "C:\Path\to\my\project.dll"

That is when I get the message I quoted above. Following the link in the error sends me to a page for getting my first Net Core app going. Not very useful. Researching the error code 0x80070057. According to Microsoft, this means One or more arguments are not valid. Another Stackoverflow post on this hresult code implies that this error is telling you that the assembly is corrupted.

I thought perhaps I was running my command incorrectly and tried doing dotnet run my.dll (using the full pathing from earlier) and got the same error. I seem to only ever get this issue on Windows 7 as my testing on Windows 10 seems to work well enough. I tried repairing my installation of Net Core and reinstalling without luck.

I'm at a loss, have anyone experienced anything like this? I also have Net 4.7.2 installed on the system, and that seems to run just fine (they're obviously two different frameworks, but I figured it could be useful information).


asked on Stack Overflow Aug 9, 2018 by Zulukas

0 Answers

Nobody has answered this question yet.

User contributions licensed under CC BY-SA 3.0