04 October 2016

“libhostpolicy.so was not found” error while running .NET Core app under Linux

If you get the following error while running .NET core app under Linux:

[root@localhost app-folder]# dotnet HelloWorld.dll

A fatal error was encountered. The library 'libhostpolicy.so' required to execute the application was not found in '/app-folder'.

The solution in my case was: The corresponding HelloWorld.runtimeconfig.json file was not in the same folder as HelloWorld.dll

Another possible cause is the missing emitEntryPoint property from the runtimeconfig.json file as discussed here.