[英]Event when a reference is added to a project
Is it possible, in a Visual Studio extension, to receive an event when a new reference is added to a (C#) project?在 Visual Studio 扩展中,是否可以在将新引用添加到 (C#) 项目时接收事件?
We've already tried DTE.Events.SolutionItemEvents.ItemAdded and DTE.Events.MiscFilesEvents.ItemAdded events, but they don't seem to get raised.我们已经尝试过 DTE.Events.SolutionItemEvents.ItemAdded 和 DTE.Events.MiscFilesEvents.ItemAdded 事件,但它们似乎没有被引发。
The ReferencesEvents interface exposes the ReferenceAdded
, ReferenceChanged
and ReferenceRemoved
interfaces. ReferencesEvents接口公开了
ReferenceAdded
、 ReferenceChanged
和ReferenceRemoved
接口。 As the docs show, you need to subscribe to these events for each project you want to monitor.如文档所示,您需要为要监视的每个项目订阅这些事件。 This means you should use the
ProjectAdded
and ProjectRemoved
events from SolutionEvents to monitor project changes too.这意味着您也应该使用SolutionEvents中的
ProjectAdded
和ProjectRemoved
事件来监视项目更改。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.