“需要库‘hostpolicy.dll’"如果从部署文件夹运行,但 emitEntryPoint 为真 [英] "The library 'hostpolicy.dll' required" if run from deploy folder, but emitEntryPoint is true

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

问题描述

我使用默认的 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

我在这个 answer 和这个 issue 在 github 上,实际问题是缺少 emitEntryPoint 属性.一切都很好,除了我的 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’"如果从部署文件夹运行,但 emitEntryPoint 为真的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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