"The library 'hostpolicy.dll' required" if run from deploy folder, but emitEntryPoint is true
Asked Answered
T

3

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?

Tachylyte answered 12/7, 2016 at 15:0 Comment(5)
Does your application work in Visual Studio debug mode, before publishing?Fruge
yes, and it works if use 'dotnet run' from project folderTachylyte
What happens if you run the published .exe, without using dotnet?Fruge
hm, don't know why I haven't check this, cause it works fine. Thank you.Tachylyte
No problem. Posted it as an answer in case anyone else runs into this! :)Fruge
F
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.

Fruge answered 12/7, 2016 at 15:23 Comment(3)
I can't get VS to generate exe even after I publish. Any ideas what could be wrong?Ryeland
@Ryeland Sounds like your csproj file may not be correct. I'd recommend posting a new question with the contents of your csproj file.Fruge
@Mayank, can you verify if the .Net core SDK version installed is same as the one specified in global.json file?Loquacious
A
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

Adorable answered 9/5, 2019 at 16:8 Comment(0)
S
-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.

Stockholm answered 3/4, 2019 at 8:56 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.