“需要库'hostpolicy.dll'”如果在deploy文件夹中运行,但emitEntryPoint为true [英] "The library 'hostpolicy.dll' required" if run from deploy folder, but emitEntryPoint is true

查看:406
本文介绍了“需要库'hostpolicy.dll'”如果在deploy文件夹中运行,但emitEntryPoint为true的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用默认的ASP.NET Core Web应用程序(.NET Framework)模板创建了一个Web API项目,然后使用VS发布到本地文件夹。

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.

现在,如果我在控制台中调用 dotnet application.exe ,则会收到以下错误消息:

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


遇到致命错误。找不到执行应用程序所需的库'hostpolicy.dll'

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

我在以下答案和此 issue 在github上,实际的问题是缺少一个embedEntryPoint属性。一切都很好,只不过我的project.json已经具有 emitEntryPoint:true

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?

推荐答案

发布应用程序并拥有.exe文件后,您无需使用 dotnet 了。该应用程序已编译!

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

只需双击运行application.exe或从控制台启动它即可。

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

这篇关于“需要库'hostpolicy.dll'”如果在deploy文件夹中运行,但emitEntryPoint为true的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆