Tuesday, January 12, 2016

MSB4175: The task factory "CodeTaskFactory" could not be loaded from the assembly "C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Microsoft.Build.Tasks.v12.0.dll".

After upgrading to TFS 2015, projects started failing to build on the (new) build server with the following error message: :

D:\Build\Sources\Source\App\.nuget\nuget.targets(71,9): error MSB4175: The task factory "CodeTaskFactory" could not be loaded from the assembly "C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Microsoft.Build.Tasks.v12.0.dll". Could not load file or assembly 'file:///C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Microsoft.Build.Tasks.v12.0.dll' or one of its dependencies. The system cannot find the file specified.

We discovered that the issue was caused by the fact that we had configured a new build server with only Visual Studio 2013 and 2015 installed. On the old build server we had Visual Studio 2012 and 2013. As this project was created in VS 2012, it was looking for the Microsoft.Build.Tasks.v12.0.dll file in C:\Windows\Microsoft.NET\Framework64\v4.0.30319 folder. However in Visual Studio 2013 this file is no longer there. Instead you can find the file in  C:\Program Files (x86)\MSBuild\12.0.

To solve it, we copied the assembly from the new location to the Framework folder…

1 comment:

Anonymous said...

I was looking for a very simple way to fix this and telling me where to find the missing dll and just copying over worked great -- thanks a lot.