Update 2015-10-12: The Azure team resolved this issue last month, and you no longer need to perform the steps that follow.

With last week’s announcement that Azure Web Apps support .NET 4.6, I excitedly upgraded one my of solutions to .NET 4.6 and pushed the changes to my git repo. Unfortunately, there was a deployment error similar to the following:

CultureHelper.cs(19,20): error CS1056: Unexpected character '$' [D:\home\site\repository\Dev14_Net46_Mvc5.Common\Dev14_Net46_Mvc5.Common.csproj]

Failed exitCode=1, command="D:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe" "D:\home\site\repository\Dev14_Net46_Mvc5\Dev14_Net46_Mvc5.csproj" /nologo /verbosity:m /t:Build /t:pipelinePreDeployCopyAllFilesToOneFolder /p:_PackageTempDir="D:localTempf8ad415b-73f5-4460-8aea-9a9643c0590f";AutoParameterizationWebConfigConnectionStrings=false;Configuration=Release /p:SolutionDir="D:\home\site\repository\.\\"

An error has occurred during web site deployment.

You can read the full details in the issue I filed on Github, but basically if your web application project references a class library project that uses C# 6 features (in my case, string interpolation), Azure Web Apps will fail to build it during deployment. Luckily, there is a simple workaround. In your Web App’s Settings screen in the Azure Portal, add the following App setting:

App settings workaround

Or, in text form:

MSBUILD_PATH=%ProgramFiles(x86)%\MSBuild\14.0\Bin\MSBuild.exe

Kudos to David Ebbo and the Project Kudu team for a quick response, a workaround, and a permanent fix. (As noted in the Github issue, they still need to thoroughly test the fix before rolling it out, so in the meantime, you’ll need to apply the workaround.)