我正在开发一个 TFS 工具来帮助我们公司的开发人员。
该工具需要能够像在源代码管理资源管理器中一样“浏览”TFS 服务器。我相信通过使用 VersionControlExt.Explorer.SelectedItems,将弹出一个 UI,使用户能够浏览 TFS 服务器(如果我错了,请纠正我)。
但是,只有在 Visual Studio(又名插件)中开发时才能访问 VersionControlExt。不幸的是,我正在开发一个不能在 VS 中运行的 Windows 应用程序。
所以问题是,我可以在 Visual Studio 之外使用 VersionControlExt 吗?如果是,如何?
这是在 Visual Studio 之外使用 Changset 详细信息对话框的尝试
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);