0

I have one project in a solution in which I am using TeamFoundation dll's of version 15 and in another project I am using TeamFoundation dll's of version 16. in my third project I want to use these two projects which are having two different versions of TeamFoundation dll's, but I am not able to use it. its giving me error:

Could not load file or assembly 'Microsoft.TeamFoundation.Client, Version=15.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies.

Also getting warning "Found conflicts between different versions of "Microsoft.TeamFoundation.Client" that could not be resolved."

How can I use two different versions of teamfoundation dll's in one project.

Required dll's:

Microsoft.TeamFoundation.Client
Microsoft.TeamFoundation.Common
Microsoft.TeamFoundation.WorkItemTracking.Client
Microsoft.TeamFoundation.WorkItemTracking.Common

As asked, I am sharing the code which I am using:

 private void connectToServer(string serverName)
    {
        TfsTeamProjectCollection teamProjectCollection = new TfsTeamProjectCollection(new Uri(tfsServerName));
        teamProjectCollection.Connect(ConnectOptions.None);
    }
   

Any help is appreciated. Thanks in advance.

jessehouwing
  • 106,458
  • 22
  • 256
  • 341
  • 2
    Why would you? You can just use 1 version for all projects. Or use a Binding Redirect to target 1 version regardless of what the code was compiled against. Only when you deploy your project into an instance of Visual Studio or Azure DevOps Server, must the version match, if stand-alone there is no need to have different versions, latest is actually recommended. If you do need to support multiple versions, check out this project which uses conditional references to work around that: https://github.com/tfsaggregator/tfsaggregator – jessehouwing Oct 08 '20 at 08:18
  • 1
    The recommended approach would be to use NuGet to pull in the required dependencies and to not use any direct assembly dependencies. – jessehouwing Oct 08 '20 at 08:21
  • Hi Shweta Paatil, did you follow jessehouwing's suggestion (use NuGet to pull in the required dependencies )? Were you able to resolve? – PatrickLu-MSFT Oct 15 '20 at 08:40

1 Answers1

0

You can switch your projects to use one common version of TeamFoundation dll's. Remove current references to local TeamFoundation dll's and add a reference to NuGet package: Microsoft.TeamFoundationServer.ExtendedClient

This package contains all needed libs and you do not need to update the source code of your applications.

Shamrai Aleksander
  • 13,096
  • 3
  • 24
  • 31