Hinweis: Dieser Artikel wurde ursprünglich veröffentlicht in 2016. Einige Schritte, Befehle oder Softwareversionen haben sich möglicherweise geändert. Überprüfen Sie die aktuelle Dokumentation von .Net für die neuesten Informationen.
Resolved: The “Microsoft.CodeAnalysis.BuildTasks.Csc” task could not be loaded from the assembly
I recently have been working on an ASP.Net application and at some point I started to get build errors that although they were not stopping the build and allowed me to continue with the application’s execution, they were starting to get quite annoying. This is a sample of the error message that tormented me for ages but because it wasn’t a show stopper I left it there for almost a week:
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.
Thankfully the solution was a simple one. If you take a look at the file in reference it points you to a packages location. It turns out that NuGet packages were committed to the repository and are breaking everything. To resolve this, you simply need to delete that packages folder (usually under
The solution recap:
- Locate you project’s packages folder
- Delete the folder
- Rebuild your project
- You’re done!
Zusammenfassung
Verwandte Artikel
- Entity Framework 4: Any way to know the plural form of an Entity Type?
- Entity Framework - Why can’t I see the child entities of my entity
- Enumeration: What are the different SharePoint permission levels and their enumeration values?
- Error 1 SQL03006: User: [ ] has an unresolved reference to Login [ ]