问题
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.
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.
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.
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!
回答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.
来源:https://stackoverflow.com/questions/49819536/type-or-namespace-name-aspnetcore-does-not-exist-error-when-publishing-to-azur