When I run my WPF application on other computers it throws me this error:
Description: A .NET Core application failed.
Application: program.exe
Path: C:\fakepath\program.exe
Message: A fatal error occurred. The required library hostfxr.dll could not be found.
If this is a self-contained application, that library should exist in
[C:\fakepath\].
If this is a framework-dependent application, install the runtime in the global location [C:\Program
Files\dotnet] or use the DOTNET_ROOT environment variable to specify the runtime location or
register the runtime location in [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x64\InstallLocation].
Add library runtime 3.1.0 it help me.
Further to Ajith's answer, "Deployment Mode: Self Contained" can also be selected in Visual Studio 2019 here:
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://learn.microsoft.com/en-us/dotnet/core/rid-catalog#windows-rids
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With