Failed to load task "Microsoft.CodeAnalysis.BuildTasks.Csc"

I am trying to publish a newly created asp.net 4.6 web project for Azure web applications and get the following error:

remote: D: \ Windows \ Microsoft.NET \ Framework \ v4.0.30319 \ Microsoft.CSharp.targets (316.9): error MSB4062: task "Microsoft.CodeAnalysis.BuildTasks.Csc" could not be loaded from assembly D: \ home \ site \ repository \ packages \ Microsoft.Net.Compilers.1.0.0 \ build .. \ tools \ Microsoft.Build.Tasks.CodeAnalysis.dll. Failed to 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 specified file. Confirm that the declaration is correct, that the assembly and all its dependencies are available, and that the task contains an open class that implements Microsoft.Build.Framework.ITask. [D: \ main \ site \ repository \ WebApp \ WebApp.csproj]

Everything builds fine through Visual Studio 2015 on my local computer. I thought that Azure web applications were configured to support VS 2015 RTM after the release, but it does not seem to have MSBuild 14.0 installed. Is there a job or a roadmap for this problem?

+4
source share
4 answers

Azure Web Apps does not yet support ASP.NET 4.6. It's on this path, so stay tuned.

+2
source

Here was a fix for me. Using the NugetPackage Manager, uninstall these two packages, if indicated:

  • Microsoft.CodeDom.Providers.DotNetCompilerPlatform
  • Microsoft.Net.Compilers

After that, run the rebuild command. This ensured that the assembly did not attempt to use a specific exe assembly. Click here for diff vs previous version

+13

In my case, I have to edit the .csproj file and find the lines below and delete them

<Error Condition="!Exists('..\packages\Microsoft.Net.Compilers.1.0.0\build\Microsoft.Net.Compilers.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Net.Compilers.1.0.0\build\Microsoft.Net.Compilers.props'))" />
<Error Condition="!Exists('..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.0\build\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.1.0.0\build\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.props'))" />

Now everything is all right,

+2
source

To solve this problem, you need to exclude the project folder from your source control. Use .gitignore to do this, and then delete the projects folder in the remote source or clean and rebuild. Good luck!

-1
source

Source: https://habr.com/ru/post/1599587/


All Articles