类型或命名空间名称“AspNetCore";发布到 Azure 时不存在错误 [英] Type or Namespace Name "AspNetCore" does not exist error when publishing to Azure

查看:32
本文介绍了类型或命名空间名称“AspNetCore";发布到 Azure 时不存在错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 Visual Studio 2017 中,我构建了没有错误的 ASP.NET Core 2.1 应用程序,但是当我尝试将其发布到 Azure 时,我收到错误信息,表明我缺少对程序集的引用 - 见下文:

In Visual Studio 2017, I build my ASP.NET Core 2.1 app with no errors but when I try to publish it to Azure, I get errors that indicate I'm missing a reference to an assembly -- see below:

但我没有缺少参考,并且这些错误指向的地方,参考就在那里,没有任何错误.

But I'm not missing a reference and where these errors point, the reference is there with no errors whatsoever.

更重要的是,只有在我在发布配置文件中针对便携式"以外的运行时才会发生这种情况.如果我为目标运行时选择可移植"并在部署模式下将其保留为依赖于框架"(见下文),我可以发布到 Azure 或文件夹中.

More importantly, this is happening ONLY IF I target a runtime other than "Portable" in my publish profile. If I select "Portable" for target runtime and leave it at "Framework dependent" in deployment mode (see below), I can publish to Azure or into a folder just fine.

知道如何解决这个问题吗?我在这里看到了一些类似的帖子,他们建议我做 dotnet restore 这没有帮助.

Any idea how to fix this issue? I've seen a few similar posts here and they suggest I do dotnet restore which didn't help.

我很感激这里的一些建议,因为这现在对我来说是一个相当大的障碍.

I'd appreciate some suggestions here as this is now becoming a pretty major obstacle for me.

因为我正在尝试使用 ASP.NET Core 2.1 Preview-2,所以我确实需要选择 x64 作为目标运行时,以便我的设置与 Azure 上安装的内容相匹配.如果我选择 x64,我无法发布.如果我使用便携式"设置发布它,Azure App 服务会给我一个错误.在此处查看我的其他帖子:ASP.NET Core 2.1 Preview 2 App 无法在 Azure 应用服务上运行

Because I'm trying to work with ASP.NET Core 2.1 Preview-2, I do need to select x64 as the target runtime so that my settings match what's installed on Azure. If I select x64, I can't publish. If I publish it with "Portable" setting, Azure App service gives me an error. See my other post on that here: ASP.NET Core 2.1 Preview 2 App Not working on Azure App Service

我真的很感激这里的一些帮助,因为我似乎完全被困住了!

I'd really appreciate some help here as I seem to be completely stuck!

推荐答案

这个谜团从未得到解决,但升级到 Visual Studio 2017 15.7.1 的最新稳定版本似乎可以解决问题.

This mystery never got resolved but upgrading to the latest stable version of Visual Studio 2017 15.7.1 seems to fix the problem.

这篇关于类型或命名空间名称“AspNetCore";发布到 Azure 时不存在错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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