Question

I am attempting to use a VSPackage to create a Tool window for visual studio 2010. I have all of that created. For my project I am attempting to access TFS 2010. For example when working on a project some files might get checked out and I make changes on them that I don't necessarily want to check in later. Rather that going through tfs and selecting all of the files I don't want to check in(can be very time consuming) I would like to be able to filter files / add files to a "do not check in" type of list. So basically If a add a file / filter for files to not check in. I want some way of connecting to the event of when someone wants to check in, the plugin / tool window can automatically deselect all of the files in the filter/ file list that I have set up. I have a good idea of what I want to do. I just need a good place to start in order to communicate with tfs. So I know I would need to be able to access my collections and also be notified of when someone wants to check in files/ that way I can modify the check in status of the file that I do not want to check in. Hopefully I made sense with all of that. Any help would be MUCH appreciated!!

Was it helpful?

Solution

The class TeamFoundationServerExt (http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.teamfoundation.teamfoundationserverext.aspx) may provide what you're looking for.

It contains the current TFS context inside Visual Studio - eg. the team project to which you're connected in Team Explorer.

From there you can get the VersionControlServer object, which in turn exposes check-in related events. More details in http://blogs.msdn.com/b/buckh/archive/2012/01/25/how-to-get-the-tfs-objects-used-in-our-own-ui-integration.aspx.

The blog post mentioned above has a nice code sample.

One last thing: If the files you're trying to filter out can be defined via regular expressions, you can use the Forbidden Patterns check-in policy, part of the Team Foundation Server Power Tools.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top