15
votes

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: enter image description here

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. enter image description here

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
What happens if you instead try to publish to a local folder? If you get the same errors (which is my guess), then at least Azure is completely out of the equation. - David Ebbo
Same error. If I run it locally, however, everything is fine. I think I started having these issues ever since I installed the update to the SDK to upgrade my app to ASP.NET Core 2.1 Preview-2. I just can't seem to publish my app anymore. - Sam
I suggest changing the title and tags to avoid confusion. This is a pure Core publishing question, unrelated to Azure. - David Ebbo
I just installed VS 2017 Preview 4, installed Net Core 2.1.300 preview 2, and was able to successfully deploy to an Azure app service with x64 config. - Maria Ines Parnisari
I'm running VS 15.7.0 Preview 4 and have the SDK upgraded .Still having the same problem. - Sam

1 Answers

2
votes

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