Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

dotnet fatal error hostfxr.dll

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?

like image 595
Marc Thomann Avatar asked Dec 13 '17 15:12

Marc Thomann


1 Answers

I tried

  • to uninstall all SDK
  • the repair tool https://www.microsoft.com/en-us/download/details.aspx?id=30135
  • Finally I tried to remove https://blogs.msdn.microsoft.com/astebner/2008/08/28/net-framework-cleanup-tool-users-guide/

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)
like image 93
Marc Thomann Avatar answered Sep 28 '22 09:09

Marc Thomann