用于转到源代码管理资源管理器中的特定项目的 Visual Studio 命令 [英] Visual Studio Command for going to a specific item in source control explorer

查看:26
本文介绍了用于转到源代码管理资源管理器中的特定项目的 Visual Studio 命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一种从插件代码内部自动打开源代码管理资源管理器的方法.到目前为止,我设法通过执行命令打开它

Im looking for a way to automatically open Source Control Explorer from inside a plugincode. So far I managed to open it by executing the command

View.TfsSourceControlExplorer

View.TfsSourceControlExplorer

然而,这似乎不接受任何论点.

However, this does not seem to accept any arguments.

我的目标是做这样的事情:

My goal here is to do something like this:

destination = "$/dev/framework/someFolder";

_dteObject.ExecuteCommand("View.TfsSourceControlExplorer", destination);

他们将向我显示指定目标中的源代码管理资源管理器.

Which will them show me Source Control Explorer in the specified destination.

推荐答案

使用以下代码在指定目的地显示源代码管理资源管理器:

Use the following code to show Source Control Explorer in the specified destination:

    public void SelectFolder(string path)
    {
        dte.ExecuteCommand("View.TfsSourceControlExplorer");

        Microsoft.VisualStudio.TeamFoundation.VersionControl.VersionControlExplorerExt explorer =
            GetSourceControlExplorer();
        if (explorer != null)
            explorer.Navigate(path);
    }

    private Microsoft.VisualStudio.TeamFoundation.VersionControl.VersionControlExplorerExt GetSourceControlExplorer()
    {
        Microsoft.VisualStudio.TeamFoundation.VersionControl.VersionControlExt versionControl =
            dte.GetObject("Microsoft.VisualStudio.TeamFoundation.VersionControl.VersionControlExt") as
                Microsoft.VisualStudio.TeamFoundation.VersionControl.VersionControlExt;
        if (versionControl == null)
            return null;

        return versionControl.Explorer;
    }

这篇关于用于转到源代码管理资源管理器中的特定项目的 Visual Studio 命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆