Search code examples
c#tfsvisual-studio-2017tfs-2015

Visual Studio 2017 Plugin: Reference to type 'TeamFoundationServer' could not be found


I work on a Visual Studio Plugin that I want to update from vs2015 to vs2017. After updating all the nuget packages I got the error:

CS7069 Reference to type 'TeamFoundationServer' claims it is defined in 'Microsoft.TeamFoundation.Client', but it could not be found

The Code causing this ist:

TfsTeamProjectCollection teamProjectCollection =/*..*/;
DocumentService doc = Dte.GetObject("Microsoft.VisualStudio.TeamFoundation.WorkItemTracking.DocumentService") as DocumentService;

IWorkItemDocument wiDoc = doc.GetWorkItem(teamProjectCollection, id, this);

So I don't use 'TeamFoundationServer' as it self because I use the other overload of the GetWorkItem method.

Microsoft.TeamFoundationServer.ExtendedClient is on Version 15.112.1, so it should contain correct Version.

I try to compile in vs2015 and 2017 getting in both cases the same error.


Solution

  • The location of assembly Microsoft.VisualStudio.TeamFoundation.WorkItemTracking.dll in VS 2017 should be in %Program Files%\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer, while in VS 2015, it locates at %Programfiles%\Microsoft Visual Studio 14.0\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer, you need to re-load it.