BuildTasks.Csc task could not be loaded from the a

2019-01-21 18:13发布

I feel guilty asking a question like this around here, but I'm at a loss and would appreciate some help.

A proof-of-concept like web application was built on one PC and put up on a repo to download on another PC at a different location. There was originally an auto-build feature set up where Azure would build and publish automatically on check-in, but that was removed. Things were working on both ends until one side included a bulk of excluded changes. Now I'm seeing the following error:

The "Microsoft.CodeAnalysis.BuildTasks.Csc" task could not 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 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.

Does anyone have any suggestions on where to begin looking for the issue?

16条回答
等我变得足够好
2楼-- · 2019-01-21 18:44
  • Right-click on your solution.
  • Go to Manage Nuget Packages.
  • Search for Microsoft.Net.Compilers.
  • Install or update on dependent projects as necessary.
查看更多
混吃等死
3楼-- · 2019-01-21 18:48

In my case, the solution was:

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

Right click on bin folder > select properties > Uncheck ReadOnly.

查看更多
Melony?
4楼-- · 2019-01-21 18:49

Deleting these three directories solves the problem.

  • /packages
  • /bin
  • /obj

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

查看更多
放我归山
5楼-- · 2019-01-21 18:51

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

查看更多
虎瘦雄心在
6楼-- · 2019-01-21 18:54

I delete all from packages folder and rebuild solution. It's worked for me.

查看更多
何必那么认真
7楼-- · 2019-01-21 18:54

Right Click on Solution. Go to Manage Nuget Packages for this Solution. Search forMicrosoft.Net.Compilers on Browse Section.

查看更多
登录 后发表回答