Tag Archives: MSBuild

MSB4175: The task factory "CodeTaskFactory" could not be loaded

I received the following error message when I tried to compile a project:

C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\CodeAnalysis\Microsoft.CodeAnalysis.targets(214,5): error MSB4175: The task factory "CodeTaskFactory" could not be loaded from the assembly "C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Build.Tasks.v12.0.dll".

Could not load file or assembly ‘file:///C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Build.Tasks.v12.0.dll’ or one of its dependencies.

The system cannot find the file specified.

The specialty of the case is that this machine had no VS 2012 installed, but only VS 2013.

The root cause of the issue may be that from VS 2013 MSBuild is part of Visual Studio instead of the .NET Framework, and therefore the related files are relocated in the file system. The error message says that the system looks for the Microsoft.Build.Tasks.v12.0.dll file in the C:\Windows\Microsoft.NET\Framework64\v4.0.30319 folder, however I have that file in the C:\Program Files (x86)\MSBuild\12.0\Bin directory. So, I simply copied the file and voila, the error was gone.

This is probably not the most elegant solution to fix this error. But because I couldn’t change the source environment, and the fix works on my machine, I can live with it very well.

 

Technorati-címkék: ,,
Advertisements