Quantcast
Channel: Visual Studio Integrate forum
Viewing all articles
Browse latest Browse all 4410

VSLangProj.VSProject.ReferenceEvents.ReferenceAdded not raised...

$
0
0

I'm implementing a FlavoredProject and I need to detect when references are added to the project so I can inspect the contents which might be used to drive some of the designer UIs that I surface. I thought I had figured out how to do this using using the VSLangProj.VSProject.ReferenceEvents.ReferenceAdded event, but that isn't working.

I'm registering for the event in the OnAggregationComplete method of my FlavoredProjectBase derived class. The code:

protected override void OnAggregationComplete()
        {
            base.OnAggregationComplete();
            var node = new VsHierarchyItem(this);
            var proj = node.ExtObject() as Project;
            var a = proj.Object as VSLangProj.VSProject;

            
            var langProj = proj.Object as VSLangProj.VSProject;
            if (langProj != null)
                langProj.Events.ReferencesEvents.ReferenceAdded += ReferencesEvents_ReferenceAdded;
        }

I can see that the event is successfully registered (the last line is executed, and doesn't throw), but the callback method that I have attached to the event is not invoked when I add a reference to the project. Am I doing something clearly wrong? Is there a better way to accomplish this?

FlavoredProjectBase also exposes FileAdded and FileRemoved events, but those are only raised when files are added, not references.

Thanks,

-Mark Pflug


Viewing all articles
Browse latest Browse all 4410

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>