Search code examples
visual-studioprojectextensibility

Determine which Items are new when ProjectsEvents.ItemAdded is fired (VS Extensibility)


In my add-in I build List<> objects of specific file types (which are project items) during the Connect() event. In order to check and possibly append new items as and when these are added I've bound the relevant event:

ProjectsEvents.ItemAdded += ProjectsEvents_ItemAdded;

But the event only passes the Project which contains the new item, not the new item itself. So my question is, inside my ProjectsEvents_ItemAdded(Project proj) event, what's the best way to get this new item?

Do I have to iterate through all items in this project and determine whether I'm already aware of them?


Solution

  • Try ProjectItemsEvents.ItemAdded.