TFS 2010 Issue: Same Names for Different Assemblies
by Petr Pruidze, .NET Team Lead
Hi, everyone. I want to describe an issue I’ve recently faced when working on a TFS-based project and share the original solution found.
The Issue
The project utilized Team Foundation Server assemblies. The need to use both TFS 2008 and TFS 2010 assemblies aroused when TFS 2010 was released. In short, the names of the assemblies stayed the same, while their versions were different.
The Solution
As you can guess, this issue had a number of solutions and it’s not the purpose of this post to make you think that mine is the best one.
Our team elaborated on several ways to solve this problem:
- Create two different branches for the project—each branch for each version of assemblies. However, we’ll have to support both branches in this case, which is not a great idea.
- Use reflections. This method is really good, but requires a great deal of time on implementation and testing.
- Compile the project for different versions of assemblies, depending on the chosen “Solution Configuration” option. Let’s have a deeper insight into this option, since it appears to be the best way to solve the issue.
Below is a step-by-step guide on implementing the solution.
To start with, open Configuration Manager.
Create a new configuration that will be used for build-building other TFS version. I’ve named the new configuration as “BuildRelease2010.”
As you may see, there’s no need to create a new configuration for each project in your solution. You may do this only in case your project utilizes different versions of assemblies—just like I had.
Open the properties of the projects that are supposed to be built with different versions of assemblies. Add “Conditional compilation symbols” to the new configuration.

Open the code itself and add the condition for working with different assemblies, if needed. In my case, the creation of the instance that implements the IserviceProvider interface required working with different versions of assemblies.
#if BUILD_RELEASE_2010
TfsTeamProjectCollection server = newTfsTeamProjectCollection(newUri(tfsUrl));
#else
TeamFoundationServer server = TeamFoundationServerFactory.GetServer(tfsUrl);
#endif
Open the .cproj file in Notepad or any other text editor, find the Reference to your assembly (in my case, it was Microsoft.TeamFoundation.dll), and add the following Condition tag: (Condition=”‘$(Configuration)’!=’BuildRelease2010′”).
..\Bin\TFS\Microsoft.TeamFoundation.dll
Now add the Reference to the new version assembly with the opposite Condition:
..\Bin\TFS2010\Microsoft.TeamFoundation.Client.dll
That’s it. Choose the configuration needed and start build-building, voila!
Pros
Implementation is fast and easy.
Cons
The look is not so preppy, as it could have been.

If you had the same issue, how did you solve it?





