Use VersionControlExt.Explorer outside Visual Studio
Posted
by Ian
on Stack Overflow
See other posts from Stack Overflow
or by Ian
Published on 2010-01-22T13:28:31Z
Indexed on
2010/03/11
20:49 UTC
Read the original article
Hit count: 507
Hi All,
I'm developing a TFS tool to assist the developers in our company.
This said tool needs to be able to "browse" the TFS server like in the Source Control Explorer. I believe that by using VersionControlExt.Explorer.SelectedItems, a UI will pop-up that will enable the user to browse the TFS server (please correct me if I'm wrong).
However, VersionControlExt is only accessible when developing inside Visual Studio (aka Plugin). Unfortunately, I am developing a Windows Application that won;t run inside VS.
So the question is, Can I use VersionControlExt outside of Visual Studio? If yes, how?
Here's an attempt on using the Changset Details Dialog outside of Visual Studio
string path = System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
Assembly vcControls = Assembly.LoadFile(path + @"\Microsoft.TeamFoundation.VersionControl.Controls.dll");
Assembly vcClient = Assembly.LoadFile(path + @"\Microsoft.TeamFoundation.VersionControl.Client.dll");
Type dialogChangesetDetailsType = vcControls.GetType("Microsoft.TeamFoundation.VersionControl.Controls.DialogChangesetDetails",true);
Type[] ctorTypes = new Type[3] {vcClient.GetType("Microsoft.TeamFoundation.VersionControl.Client.VersionControlSever"),
vcClient.GetType("Microsoft.TeamFoundation.VersionControl.Client.Changeset"), typeof(System.Boolean)};
ConstructorInfo ctorInfo = dialogChangesetDetailsType.GetConstructor(ctorTypes);
Object[] ctorObjects = new Object[3] {VersionControlHelper.CurrentVersionControlServer, uc.ChangeSet, true};
Object oDialog = ctorInfo.Invoke(ctorObjects);
dialogChangesetDetailsType.InvokeMember("ShowDialog", BindingFlags.InvokeMethod, null, oDialog, null);
© Stack Overflow or respective owner