Search code examples
asp.netazurevisual-studio-2017azure-web-app-servicekudu

Azure App Service Deployment Centre fails to deploy from GitHub repo


I had an issue where I am developing a web service in Visual Studio 2017, ASP.NET with .NET version 4.7. When publishing to Azure from Visual Studio, it published fine and ran fine, it also runs in debug with no problems.

However, when I linked up the GitHub repo to the Azure App Service and pushed the updates to GitHub, then syncing Azure and waiting for it to pick up the updates and then deploy the app using Kudu, it would sync but then give multiple syntax errors along the lines of ';' expected, '(' expected, etc when attempting to deploy, and would therefore fail.


Solution

  • Apparently this is due to Azure using MSBuild 14, when it should be using MSBuild 15 for my VS2017 project. I don't understand the intricacies, and can't find many references to this issue online, but the issue was resolved by adding the Microsoft.Net.Compiler NuGet package to the project and then pushing this to GitHub and syncing the repo within Azure Deployment Centre.