I want my extension to do something everytime an item gets added to the project. This works fine for normale Projects or, with some magic (see here), for the Project Type "Website". But i cant get it to work with .xproj.
Here my current code to access the ItemAdded event (shortened)
var events = _dte.Events as Events2;
_projectItemEvents = events.ProjectItemsEvents;
_projectItemEvents.ItemAdded += ItemAdded;
_websiteItemEvents = events.GetObject ("WebSiteItemsEvents") as ProjectItemsEvents;
_websiteItemEvents.ItemAdded += ItemAdded;
_csharpItemEvents = events.GetObject ("CSharpProjectItemsEvents") as ProjectItemsEvents;
_csharpItemEvents.ItemAdded += ItemAdded;
Does anyone know how to access the ItemAdded event in case of an .xproj project type?
Edit: Edited code; The variables are all class fields and are not garbage collected, as in case of the other project types, the events are fired properly, just not in case of an .xproj.