Visual Studio 2010 无法识别正确的源代码管理插件 [英] Visual Studio 2010 Not Recognizing proper Source Control Plug In

查看:41
本文介绍了Visual Studio 2010 无法识别正确的源代码管理插件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从事使用不同源代码控制提供程序的不同项目.Subversion、Git、TFS 等...

I work on different projects that use different source control providers. Subversion, Git, TFS, etc...

为了在 Subversion 上工作,我安装了 AnkhSVN.为了使用 Git,我安装了 Git Source Control Provider要在 TFS 上工作,...好吧,你明白了.

To work on Subversion, I've installed AnkhSVN. To work on Git, I've installed the Git Source Control Provider To work on TFS, ...well, you get the idea.

源代码控制信息作为解决方案文件的一部分保存.

The source control information is saved as part of the solution file.

然而,当我打开一个新项目时,Visual Studio 总是使用最后一个选择的源代码控制提供程序.它似乎没有从解决方案文件中提取它.我总是必须打开工具">选项"对话框来切换提供程序(这需要永远!)

Yet, invariably, when I open a new project, Visual Studio keeps using whatever the last source control provider selected was. It doesn't seem to pick it up from the solution file. I always have to open the Tools > Options dialog to switch providers (which takes FOREVER!)

这是我做错了吗?我希望 Visual Studio 能够根据开放的解决方案更改提供程序.

Is this something I am doing wrong? I would expect Visual Studio to change providers based on the solution that is open.

如果这是 Visual Studio 根本不做的事情,是否有宏或扩展可以自动解决这个问题?

If this is something Visual Studio simply doesn't do, is there a macro or extension out there that will automatically figure this out?

我不敢相信之前没有人问过这个问题,但我在 StackOverflow 的可能已经有答案的问题"列表中没有看到任何明显的欺骗.可悲的是,这似乎指向了这只是我"的答案.

I can't believe this question hasn't been asked before, but I didn't see any obvious dupes in the StackOverflow list of "Questions that may already have your answer." Which, sadly, seems to point to the answer of "it's just me."

推荐答案

IMO,每个解决方案提供者的绑定是错误的,因为该解决方案可以驻留在多个源代码控制系统中.诀窍是在 VS 扩展的预加载解决方案事件中加载正确的源代码控制提供程序检查保留目录.核心代码如下:

The per solution provider binding is, IMO, wrong as the solution can be resident in multiple source control systems. The trick is to load the proper source control provider checking reserved directories in a pre-load solution event of a VS extension. The core code is as it follow:

IVsRegisterScciProvider vsRegisterScciProvider = GetService<IVsRegisterScciProvider>();
vsRegisterScciProvider.RegisterSourceControlProvider(sccProviderGuid);

此类扩展的完整代码位于此处.我可能会在经过一些测试后不久发布它,因为它非常简单,即使它需要我进行大量研究.我在周围找不到任何类似的东西,这对我来说很奇怪,因为这应该是一种令人讨厌的方式.关于 RegisterSourceControlProvider 的文档也极具误导性,这可能是原因.

The full code for such an extension is here. I may release it shortly after a bit of testing as it's very simple, even if it required me a lot of research. I couldn't find anything similar around and it's strange to me as it should be the obious way to do it. The documentation about RegisterSourceControlProvider was also extremely misleading so that may be the reason.

这篇关于Visual Studio 2010 无法识别正确的源代码管理插件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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