Visual Studio可扩展性(VSX)-获取当前的分支名称 [英] Visual Studio Extensibility (VSX) - Get the current branch name

查看:207
本文介绍了Visual Studio可扩展性(VSX)-获取当前的分支名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发Visual Studio扩展(VS软件包).

I am developing a Visual Studio extension (VS Package).

我正在尝试获取项目/解决方案的Source Control分支名称.

I am trying to get the Source Control branch name for a project/solution.

VS SDK中唯一可用的源代码控制服务是SVsSccManager,但它不提供任何检索源代码控制分支名称的方法.

The only source control service available in the VS SDK is SVsSccManager but that doesn't provide any means of retrieving the source control branch name.

还查看了DTE.SourceControl,但可惜它没有提供分支信息.

Also looked at DTE.SourceControl but alas, it doesn't give branch info.

我真的不想开发自己的Source Control插件来简单地检索分支名称(这似乎完全过头了).

I really don't want to develop my own Source Control plug-in to simply retrieve the branch name (this feels like total overkill).

在解决方案/项目的源代码管理中,是否有任何方法可以检索当前分支名称?

Is there any way of retrieving the current branch name in source control for a solution/project?

先感谢

推荐答案

Visual Studio可扩展性(VSX)-获取当前的分支名称

Visual Studio Extensibility (VSX) - Get the current branch name

如果您使用的是git,则已经有Visual Studio扩展在标题栏上显示您当前的Git分支: ShowMyGitBranch .

If you are use git, there is already Visual Studio extension that displays your current Git branch on the title bar: ShowMyGitBranch.

您可以查看有关此扩展程序的源代码以获取更多详细信息:

You can check the source code about this extension for more details:

https://github.com/thiagotts/show-my-git-branch

如果您使用的是TFS,则可以对项目使用API​​ get分支:

If you are use TFS, you can use API get branch for a project:

希望这会有所帮助.

这篇关于Visual Studio可扩展性(VSX)-获取当前的分支名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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