Visual Studio 2010源代码控制自动化问题 [英] Visual Studio 2010 Source Control Automation Question

查看:74
本文介绍了Visual Studio 2010源代码控制自动化问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好 -


 在Visual Studio 2003中我创建了一个Visual Studio加载项(使用C#),它允许我挂钩到Visual Studio事件知道何时签入文件。  


 在IDTExtensibility2接口OnConnection方法中,我为EventDTE.CommandEvents对象AfterExecute和BeforeExecute事件创建了处理程序。  在AfterExecute和BeforeExecute处理程序中,您可以知道
正在触发的事件类型。      在这些处理程序中,我可以看到什么类型的事件正在触发并执行某些操作。  在我的情况下,我想知道何时将文件检入源代码控制,我能够做一些事情,比如取消事件,
可以在BeforeExecute处理程序中完成。


 这是BeforeExecute处理程序的签名


 
public void BeforeExecute( string Guid, int ID, object CustomIn,对象 CustomOut, ref bool CancelDefault)

解决方案


Hi



 



我认为你提到的是使用

DTE.CommentEvents
,这些也可以在VS2010中使用。但是,在VS2010中,这些方法仅供Microsoft内部使用。我们建议您不要这样使用。



 



据我所知,VS2010并没有提供挂钩命令事件的一般方法。如果它用于您的业务,您可以创建自己的"登记/退房"”
命令并实现内部的所有检查逻辑。



 



自动化导出了大量的API,我们可以处理一些来自TFS的活动,如
VersionControlServer类
以获取有关该事件的更多详细信息。



 



问候,



Yi



Hello -

 In Visual Studio 2003  I had created a Visual Studio Add-In (using C#) which allowed me to hook into Visual Studio Events to know when a file was being checked in.   

  Within the the IDTExtensibility2 interfaces OnConnection method I created handlers for the EventDTE.CommandEvents objects AfterExecute and BeforeExecute events.  Within the AfterExecute and BeforeExecute handlers you can tell what type of event is firing.      In these handlers I could see what type of event was firing and do certain things.   In my case I wanted to know when a file was being checked into source control, and I was able to do some things, such as cancel the event, which can be done in the BeforeExecute handler.

  here is the signature for the BeforeExecute handler

   public void BeforeExecute(string Guid, int ID, object CustomIn, object CustomOut, ref bool CancelDefault)

解决方案

Hi

 

I think what you mentioned is to use DTE.CommentEvents, these are also available in VS2010. However, in VS2010, these methods are for Microsoft internal use only. We don’t recommend you use this way.

 

As far as I know VS2010 doesn’t offer a general way to hook a command event. If it is used for your business, you may create your own “check in/out” command and implement all the checking logical inside.

 

Work with a specific source control is more reasonable to me. Generally for VS2010, we use TFS as the major source control, since TFS SDK exports lots of APIs for automation, we can handle some events from TFS like VersionControlServer Class to get more detailed information about the event.

 

Regards,

Yi


这篇关于Visual Studio 2010源代码控制自动化问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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