Lawtonfogle
Lawtonfogle

Reputation: 959

Where is the Microsoft.VisualStudio.TeamFoundation reference?

So in a Visual Studio extension, when the menu item is pressed, I want to check what is my current page in team explorer.

So, first I get the ITeamExplorer object:

ITeamExplorer teamExplorer = (ITeamExplorer)this.GetService(typeof(ITeamExplorer)).

Next, I want to make sure I am on the pending changes page.

if(teamExplorer != null) 
{
    if(teamExplorer.currentPage is ???)
    { 
        //Do stuff.
    }
}

Now, if I run this in debug (commenting out the last if part so it compiles, open the team explorer onto the pending changes page, and break after I get the ITeamExplorer object, I can inspect it and see that the current page is of type Microsoft.VisualStudio.TeamFoundation.VersionControl.PendingChanges.PendingChangesPageVS.

But I cannot find any reference that lets me actually compare the type to make sure the page is of the same type.

Microsoft.VisualStudio is valid. Microsoft.TeamFoundation is valid. But there is not Microsoft.VisualStudio.TeamFoundation. I've checked references to see if I forgot to include it, but it isn't there either.

Is it hiding somewhere else? In a nuget package? Perhaps in a Team Foundation Server SDK I need to install?

EDIT 1:

Found the dll in C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\PrivateAssemblies. Guess I need to see what it takes to reference a private assembly.

EDIT 2:

Copying that dll into C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\ReferenceAssemblies\v4.5 allowed me to reference it. But I feel like I'm doing something I shouldn't be doing.

Upvotes: 2

Views: 2588

Answers (2)

csrowell
csrowell

Reputation: 924

FYI -

For VS 2015, you can find its location by navigating to C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer. If you go there and then go up one directory you will see that Team Explorer is a symbolic link to C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\ftq4t4pd.guv (in my case). So it’s like instead of shipping the DLLs with the product they ship them in an extension and whenever the extension updates they update that symbolic link to point at it. Very odd.

For VS 2017, you can find it by navigating to C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer, replacing "Professional" with whatever version you have installed. It doesn't appear VS 2017 has the symbolic link thing going on.

Upvotes: 0

Lawtonfogle
Lawtonfogle

Reputation: 959

So, from my answers, I found the reference. I copied the Microsoft.VisualStudio.TeamFoundation.VersionControl from C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\PrivateAssemblies to C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\ReferenceAssemblies\v4.5 and I could reference it. I probably could have also included the dll by browsing to C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\PrivateAssemblies.

That being said, the class I wanted is internal, so that didn't help. Instead I did something far easier that didn't require the dll. I just used teamExplorer.CurrentPage.GetType().ToString() and compared it to a string comparing the class name I expected ("Microsoft.VisualStudio.TeamFoundation.VersionControl.PendingChanges.PendingChangesPageVS").

Upvotes: 4

Related Questions