dotnet fatal error hostfxr.dll

Marc Thomann picture Marc Thomann · Dec 13, 2017 · Viewed 11.1k times · Source

After installing .Net Framework 4.7.1 my dotnet installation was somehow broken.

I was no longer able to develop with Visual Studio 2015 nor was I able to run anything related to .Net Core. I tried to the following in the command line

C:\Program Files\dotnet>dotnet --help

Result:

A fatal error occured, the required library hostfxr.dll could not be found at C:\Program Files\dotnet

What can I do?

Answer

Marc Thomann picture Marc Thomann · Dec 13, 2017

I tried

Nothing helped me out.

Finally my solution is pretty hacky:

  1. Copy the file hostfxr.dll found in a subfolder of "C:\Program Files\dotnet" directly to the main folder "C:\Program Files\dotnet" where the dotnet.exe is located
  2. Delete the folder C:\Program Files\dotnet\sdk
  3. Delete the folder C:\Program Files\dotnet\shared
  4. Uninstall all .Net Core Versions
  5. Install the latest and required .Net Core SDK
  6. Remove the file hostfxr.dll again from the folder "C:\Program Files\dotnet" (from step 1)