Visual Studio On Mac Deploy To Azure Error

I went a little nuts last night trying to deploy a web application to Azure. Debugging my own code is hard enough, but dealing with vendor issues is nearly impossible due to lack of control and insight to the problem.

When debugging issues sometimes it helps to go back to square one. So I did that. I haven’t found a solution to my problem yet, but I thought I’d write this up in case it helps anyone.

My issue is deploying to an Azure web application failed when pushing from a local git repository. I couldn’t figure out what my problem was, so I decided to try to deploy a default web application. I was trying to do this from Visual Studio 2015 on the Mac which I know is kind of in beta, but I really wanted to work from the Mac.

Here’s what I did:

1 Create a brand new Azure web application using D1 Shared hosting and configure it for Local Git deployment.

Mac Test Azure Setup

2 Create a brand new default ASP.NET MVC web application using the latest version of Visual Studio 2015 for Mac.

Mac Test VS Setup

3 Git init the new project folder, add the Azure git remote, commit everything and push.

Mac Test git init Mac Test git push

4 At this point Azure should receive the git push, kick off a build, and deploy my site to the Azure web folder. Instead I see this:

Mac Test - Azure deploy

When I look at the log file I see the error:

D:\home\site\repository\BillTestMac\BillTestMac.csproj : error MSB4057: The target “pipelinePreDeployCopyAllFilesToOneFolder” does not exist in the project.

Mac Test - Azure error log

This isn’t good. I need to know that the default out of the box project is a good starting point. When debugging I always assume my code is the point of failure first. However, now that assumption goes out the window.

Just to make sure it wasn’t something I was messing up, I tried the whole thing from Windows 10 using Visual Studio 2015 Community.

1 Create brand new Azure web application

Win Test - Azure setup

And then set it up for Local Git deployment

Win Test - Azure deploy setup

2 Create a brand new ASP.NET MVC web application in Visual Studio 2015 Community

Win Test - vs setup

3 Git init the new project folder, add the Azure git remote, commit everything and push.

Win Test - git init

4 This time the Azure build and deploy succeeds

Win Test - azure deploy

After this I spent a few hours trying to find out what the issue was. I tried using ASP.NET Core on the Mac and pushing that to Azure, but that just produced different errors.

I tried searching for the error message and came across this StackOverflow post. Which is sort of old and didn’t really address the same issue I was seeing. However, it did prompt me to take a look at the .csproj files produced from each version.

The version created on Windows 10 had the Import lines mentioned on StackOverflow. The version created on the Mac didn’t have any of those lines. I suspect the Mac version needs them to deploy correctly.

I’m not sure why they didn’t use the same project template files on the Mac version of Visual Studio. Maybe it’s a beta thing and they will become the same? Maybe there’s some difference in how those project files need to be produced?

I also thought about adding the lines to the Mac project file, but I didn’t try that. The first thing I thought to try was getting a copy of the default project from Windows 10 and using it on the Mac.

I thought this would be fine. I could create my initial project on Windows 10, check it into Git, and then continue with the rest of my coding on the Mac using Visual Studio.

However, this didn’t work out the way I thought. When I tried to use the Windows 10 created project in Visual Studio for Mac, I couldn’t even add a new file to the project. But I’ll save that story for another post.