TFS TeamBuild doesn't copy references (Assemblies)

As a TFS administrator, I often have to solve the same issue again and again: new developers complain that referenced assemblies are not dropped by TeamBuild although locally, Visual Studio copies those references into the bin folder... The trick is to set the property "Copy Local" = "False" on the references to be copied, Save the project, reset the property "Copy Local" = "True" and Save again the project.

Click to Read More

We have experienced this issue at least with VS 2010 - TFS 2010 and VS 2013 - TFS 2013. I have to say I don't remember about VS 2008 - TFS 2008  and VS 2005 - TFS 2005.

Project's "Copy Local" property is the one that indicates if a file reference must be copied or not in the output folder. The value of that property is stored in a tag <Private> in the project file (.csproj, .vbproj, ...). Ex.: <Private>true</Private>

The problem is that VS does not add this tag for references whose 'Copy Local' property is 'true', 'true' being the default value for file references added on assemblies not in the GAC. It only adds this tag if one changes the property value to 'false'. Later, if one sets the value back to 'true', the tag is kept but its value is changed.

This is a problem because MSBuild, run by TeamBuild to compile the projects, assume that the value of a "Copy Local" property is 'False' if the tag <Private> is not found in the project file.

So, the trick is to force VS to add the tag for all references added with 'Copy Local'='true'. This can be done as explained above:  set "Copy Local" = "False" on the required references, Save the project, reset "Copy Local" = "True" and Save again the project.

Leave a Reply

Your email address will not be published. Required fields are marked *