Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The "Microsoft.CodeAnalysis.BuildTasks.Csc" task could not be loaded

I'm trying to publish a newly created asp.net 4.6 web project to Azure web apps and receiving the following error:

remote: D:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.CSharp.targets(316,9): error MSB4062: The "Microsoft.CodeAnalysis.BuildTasks.Csc" task could not be loaded from the assembly D:\home\site\repository\packages\Microsoft.Net.Compilers.1.0.0\build..\tools\Microsoft.Build.Tasks.CodeAnalysis.dll. Could not load file or assembly 'Microsoft.Build.Utilities.Core, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified. Confirm that the declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask. [D:\home\site\repository\WebApp\WebApp.csproj]

Everything builds fine via Visual Studio 2015 on my local machine. I thought Azure web apps were all set to support VS 2015 RTM upon release, but it would appear they do not have MSBuild 14.0 installed. Is there a work around or a roadmap for this problem?

like image 759
Chris Avatar asked Jul 24 '15 21:07

Chris


1 Answers

Here was the fix for me. Using Nuget Package Manager, remove these two packages if referenced:

  1. Microsoft.CodeDom.Providers.DotNetCompilerPlatform
  2. Microsoft.Net.Compilers

After that, run a rebuild. This ensured that the build was not trying to use a specific build exe. Click here for the Diff against previous revision

like image 125
jbooker Avatar answered Sep 30 '22 04:09

jbooker