从 Visual Studio 2015 获取 VersionControlServer(tfs 2015) 的 运行 实例,将 GettingEventHandler 绑定到它
Get the running instance of VersionControlServer(tfs 2015) from Visual Studio 2015 to bind a GettingEventHandler to it
我想扫描所有 XML- 已从服务器签出的文件。
Microsoft.VisualStudio.TeamFoundation.VersionControl.VersionControlExt project =
dte.GetObject("Microsoft.VisualStudio.TeamFoundation.VersionControl.VersionControlExt") as
Microsoft.VisualStudio.TeamFoundation.VersionControl.VersionControlExt.Project;
我试过了。但是我得到一个 NullPointerException。
我正在寻找触发事件或其他事情的东西。在服务器端有 ISubscriber 接口。
dte 对象不工作是因为它没有事件触发器。
----编辑---
Tfs.client 包中有一个 "GettingEventHandler"。我可以将东西绑定在一起,但我需要 Visual Studio 2015
中的 VersionControlServer 实例 运行
作为替代,您也可以安装 TFS 2015 power tools。
您可以通过selecting File -- Source Control -- Find -- Find by Status 来查找受状态版本控制的文件,然后您可以在您 select。
我看过所有来自 TFS 的事件都是跨实例的。我刚刚启动了一个新实例并将我的事件处理程序附加到它。效果很好。
tfs = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(new Uri(serveradressename));
versionControl = (VersionControlServer)tfs.GetService(typeof(VersionControlServer));
versionControl.Getting += new GettingEventHandler(ScanAllNewDocs);
我想扫描所有 XML- 已从服务器签出的文件。
Microsoft.VisualStudio.TeamFoundation.VersionControl.VersionControlExt project =
dte.GetObject("Microsoft.VisualStudio.TeamFoundation.VersionControl.VersionControlExt") as
Microsoft.VisualStudio.TeamFoundation.VersionControl.VersionControlExt.Project;
我试过了。但是我得到一个 NullPointerException。
我正在寻找触发事件或其他事情的东西。在服务器端有 ISubscriber 接口。
dte 对象不工作是因为它没有事件触发器。
----编辑---
Tfs.client 包中有一个 "GettingEventHandler"。我可以将东西绑定在一起,但我需要 Visual Studio 2015
中的 VersionControlServer 实例 运行作为替代,您也可以安装 TFS 2015 power tools。
您可以通过selecting File -- Source Control -- Find -- Find by Status 来查找受状态版本控制的文件,然后您可以在您 select。
我看过所有来自 TFS 的事件都是跨实例的。我刚刚启动了一个新实例并将我的事件处理程序附加到它。效果很好。
tfs = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(new Uri(serveradressename));
versionControl = (VersionControlServer)tfs.GetService(typeof(VersionControlServer));
versionControl.Getting += new GettingEventHandler(ScanAllNewDocs);