“The library 'hostpolicy.dll' required” if run from deploy folder, but emitEntryPoint is true

梦想与她 提交于 2019-12-19 07:48:47

问题


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?


回答1:


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.




回答2:


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




回答3:


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.



来源:https://stackoverflow.com/questions/38332512/the-library-hostpolicy-dll-required-if-run-from-deploy-folder-but-emitentry

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!