BuildTasks.Csc task cannot be loaded from assembly?

I feel guilty asking such a question here, but I am at a loss and appreciate some help.

A proof of concept, such as a web application, was built on one PC and placed on a repo to be downloaded to another computer in another place. An auto-build feature was originally created in which Azure will automatically create and publish upon registration, but this has been removed. Things worked at both ends until one side included most of the excluded changes. Now I see the following error:

The task "Microsoft.CodeAnalysis.BuildTasks.Csc" cannot be loaded from the assembly ... \ packages \ Microsoft.Net.Compilers.1.0.0 \ build .. \ Tools \ Microsoft.Build.Tasks.CodeAnalysis.dll. Could not load file or assembly 'File: /// ... \ packages \ Microsoft.Net.Compilers.1.0.0 \ tools \ Microsoft.Build.Tasks.CodeAnalysis.dll' or one of its dependencies. The system cannot find the specified file. Ensure 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.

Does anyone have any suggestions on where to start looking for a problem?

+88
asp.net-mvc entity-framework azure vsts azure-devops
Aug 21 '15 at 22:33
source share
19 answers

It turns out that NuGet packages were tied to the repository and broke everything. Removing the project directory \ project \ packages from the repo solves all build problems, since NuGet automatically extracts packages during assembly.

+112
Aug 22 '15 at 11:50
source share

I had this error when I created a new branch for my project.

It made me crazy for an hour. I have tried most of the suggestions on the internet, including the accepted answer to this question.

Then I closed the project, reopened it, cleared it, and the error disappeared. So this means that it could be a cache problem.

In any case, I just wanted to share.

+64
Dec 01 '15 at 1:21
source share

I also tried the top answer with no luck, so I deleted the contents of my bin and the dir package, closed and reopened VS, and now everything is fine.

+34
May 12 '16 at 9:29 a.m.
source share

I tried all the solutions described earlier, but no one worked.

What decided for me was to update Microsoft.Net.Compilers from NuGet Package Manager

+16
Jan 19 '17 at 10:30
source share
  • Right click on your solution.
  • Go to Nuget Package Management.
  • Search Microsoft.Net.Compilers .
  • Install or upgrade dependent projects if necessary.
+12
Feb 08 '17 at 19:48
source share

Restore, clean up the solution and restart Visual Studio for me.

+6
Feb 22 '17 at 11:13
source share

Removing the package and cleaning the solution solved it for me.

+4
Nov 22 '16 at 4:25
source share

Removing these three directories solves the problem.

  • packages
  • /Ben
  • /an object

NOTE : remove both / bin and / obj from all projects included in the solution (including test projects).

+4
Dec 09 '16 at 16:06
source share

The problem is hidden in TFS, you need to delete the TestProject ... \ packages folder from TFS, register it, delete it from the local directory and create it again. Worked!

+3
Dec 14 '15 at 20:27
source share

I delete everything from the package folder and rebuild the solution. It worked for me.

+3
Jul 24 '17 at 13:56 on
source share

In my case, the solution was:

Use Windows Explorer and go to the correct path: C: \ MyApplication \ Code \ Main \ ABCProject \ ABCProject.UI \ Bin

Right-click the bin folder> select properties> Uncheck ReadOnly.

+1
May 02 '17 at 18:50
source share

In my case: this works for me.

It turns out that my teammate has already begun to study the development of Windows 10 and Microsoft Build Tools 2015 was installed on it.

I installed the software from https://www.microsoft.com/en-us/download/details.aspx?id=48159 and the problem was resolved.

+1
Dec 20 '17 at 14:01
source share

I just tried this on a clean install of Windows 10, and the problem for me ended up not having the .NET 3.5 platform installed. This stackoverflow question helps explain why.

Unable to create a WIX project on Windows 10

0
Jun 20 '17 at 20:25
source share

Right-click on Solution. Go to the Nuget Package Management section for this solution. Look for Microsoft.Net.Compilers in the browse section.

0
Mar 13 '18 at 14:32
source share

In my case, the solution was:

  1. Right-click on Solution.
  2. Go to the Nuget Package Management section for this solution.
  3. Search for Microsoft.CodeDom.Providers.DotNetCompilerPlatform .
  4. Remove the found package.
  5. Restart Visual Studio.
0
Apr 11 '18 at 6:35
source share

Removing the bin folder worked for me

0
Oct 29 '18 at 16:58
source share

The vs2017 community has a new item in the "build" menu. It disappeared after I used it, and was called something like " Optimizing project build packages ." I clicked on it, and she fixed it, just rebooted, etc. I did it on two cars.

What was done was removed by Microsoft.net.compilers 2.10.0 and replaced by Microsoft.CodeDom.Providers.DotNetCompilerPlatform 2.0.1

So you go - more automatic ...

0
Mar 07 '19 at 6:49
source share

My project was built using .Net Core 2.2, but I had a preview of .Net core 3.0 installed. I removed .Net Core 3.0 from my system and went through all my class libraries by uninstalling Microsoft.Net.Compilers 3.0, then rebuilt and it worked.

0
Jun 24 '19 at 22:04
source share

Use the next step:

1) Delete the package folder.
2) close the visual studio.
3) open the project and rebuild the project.

0
Aug 29 '19 at 11:33 on
source share



All Articles