Saturday, September 18, 2010

Compiling a VS2008 project on a TFS2010 build server

After upgrading to Team Foundation Server 2010, some Visual Studio 2008 project failed to build on the build server.

In the build log file, I found the following error message:

The type 'System.Func<TResult>' exists in both 'c:\Program Files\Reference Assemblies\Microsoft\Framework\v3.5\System.Core.dll' and 'c:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\mscorlib.dll' [D:\Builds\01 Development Core\Sources\Core\Business Process Layer\Core.Bpl\Core.Bpl.csproj

The problem was caused by a bug in the build engine which is using the .NET 4 Workflow libraries. As this project was originally created as a workflow library, we end up with a conflict as both the .NET 4 workflow libraries and the .NET 3 libraries were loaded in the same process. As we were no longer using the workflow functionality in this project, I removed the references to the .NET 3.5 System.Workflow dll. But the build still failed…

Further investigation showed that I not only had to remove the references but also open up the csproj file and remove the following line:

<Import Project="$(MSBuildExtensionsPath)\Microsoft\Windows Workflow Foundation\v3.5\Workflow.Targets" />

Removing it solved the issue.

No comments: