简体   繁体   English

将引用添加到项目时的事件

[英]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接口公开了ReferenceAddedReferenceChangedReferenceRemoved接口。 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中的ProjectAddedProjectRemoved事件来监视项目更改。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 添加添加服务参考项目参考时 - When add service reference project references are added 当它似乎被添加到项目时,引用丢失的错误 - Error that reference is missing when it seems to be added to project 添加项目引用和 nuget 提要时,Docker 构建失败 - Docker build fails when project reference and nuget feed added 在项目中“添加为链接”时如何引用dll? - How do I reference dlls when “added as link” in project? C# - 从我添加的 NET.dll 文件定义事件作为对我的项目的引用 - C# - Defining an event from a NET .dll file I added as a reference to my project 如何将 dll 作为引用包含在 nuget 中,当 nuget 添加到项目时,该引用也被复制为引用 - How do I include dll as reference in nuget that also gets copied as reference when nuget added to project 为什么已经从另一个项目添加了此引用,为什么还要添加相同的引用 - Why I need to add same reference when this reference had been added from another project 在Visual Studio项目中添加Microsoft.Office参考时,使用exe部署哪个dll? - What dll to deploy with exe when Microsoft.Office reference is added in Visual Studio project? 尝试引用作为URI添加到项目中的脚本 - Trying to reference a script added to a project as a URI 我添加了一个项目作为参考,但仍然找不到 - I added a project as reference but it still cannot be found
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM