我已經創建了VS擴展,它在源代碼管理資源管理器上創建菜單命令,右鍵單擊它打開自定義窗體,現在我想顯示當前TFS路徑從那裏用戶右鍵單擊)在該自定義窗體中。稱爲TFS「分支和合並=>分支」源路徑。我如何從源代碼管理資源管理器使用VS包得到當前分支路徑
任何幫助欣賞。
我已經創建了VS擴展,它在源代碼管理資源管理器上創建菜單命令,右鍵單擊它打開自定義窗體,現在我想顯示當前TFS路徑從那裏用戶右鍵單擊)在該自定義窗體中。稱爲TFS「分支和合並=>分支」源路徑。我如何從源代碼管理資源管理器使用VS包得到當前分支路徑
任何幫助欣賞。
可以使用VersionControlExplorerExt對象及其屬性SelectedItems,CurrentFolderItem等從封裝它會是這樣的:
private void MenuItemCallback(object sender, EventArgs e)
{
Microsoft.VisualStudio.TeamFoundation.VersionControl.VersionControlExt versionControlExt;
Microsoft.VisualStudio.TeamFoundation.VersionControl.VersionControlExplorerExt versionControlExplorerExt;
EnvDTE.DTE dte;
try
{
dte = base.GetService(typeof(EnvDTE.DTE)) as EnvDTE.DTE;
versionControlExt = dte.GetObject("Microsoft.VisualStudio.TeamFoundation.VersionControl.VersionControlExt")
as Microsoft.VisualStudio.TeamFoundation.VersionControl.VersionControlExt;
versionControlExplorerExt = versionControlExt.Explorer;
MessageBox.Show(versionControlExplorerExt.CurrentFolderItem.LocalPath);
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
Source Control Explorer的擴展性應通過VersionControlExt.Explorer類暴露。 VersionControlExt.Explorer.SelectedItems屬性應該包含所選項目的服務器路徑。這是一個old blog post,它也可能有一些用於編寫擴展的有用信息。