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

我的未来我决定 提交于 2019-12-14 02:31:07

问题


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

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

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.

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

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?

Thanx in advance.


回答1:


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

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

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

https://social.msdn.microsoft.com/Forums/en-US/89802f2e-f410-4a3a-a9c1-f776a3dd884e/api-get-branch-for-a-project?forum=tfsversioncontrol

Hope this helps.



来源:https://stackoverflow.com/questions/52087358/visual-studio-extensibility-vsx-get-the-current-branch-name

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!