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

查看:129
本文介绍了类型或命名空间名称"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服务会给我一个错误.在此处查看我的其他帖子:

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天全站免登陆