7

I created a Web API project using the default ASP.NET Core Web Application (.NET Framework) template and then published to local folder using VS.

Now if I call dotnet application.exe in the console, I receive the following error:

A fatal error was encountered. The library 'hostpolicy.dll' required to execute the application was not found

I have found in this answer and this issue on github, that the actual problem is a missing emitEntryPoint property. All is fine, except that my project.json already has "emitEntryPoint": true

What else can cause this error?

Community
  • 1
  • 1
Set
  • 47,577
  • 22
  • 132
  • 150

3 Answers3

16

Once you publish the application and have a .exe file, you don't need to use dotnet anymore. The application is compiled!

Just run application.exe by double-clicking it, or launching it from the console.

Nate Barbettini
  • 51,256
  • 26
  • 134
  • 147
0

Make sure you install the correct version of ASP Net Core in the server.

Here is the download link:

https://dotnet.microsoft.com/download/dotnet-core

Wildan Muhlis
  • 1,553
  • 2
  • 22
  • 43
-2

We ran in the same problem building our app in CI. Apparantly a reference towards another unittest project slipped in. This Created the error at hand.

Tom Tavernier
  • 383
  • 2
  • 6