A fatal error occurred. The required library hostfxr.dll could not be found

Further to Ajith's answer, "Deployment Mode: Self Contained" can also be selected in Visual Studio 2019 here:

GUI in Visual Studio


I got the same error for my .Net core 3.0 app today. This is because you are missing the .net core run time in the machine, and is installing a framework dependent application.

The solution for this is to publish the application with Deployment Mode Self Contained.

Use the below command to publish from command line

dotnet publish -c Release -r <RID> --self-contained true

get the RID details from https://docs.microsoft.com/en-us/dotnet/core/rid-catalog#windows-rids