Visual Studio Extensibility Package Doesn't Look at the Right Project

I created a new extensibility package VS 2010. For now, all I want to do is click the user button and fill out the list with all the contents of the solution. I have the following code:

EnvDTE80.DTE2 dte = (EnvDTE80.DTE2)System.Runtime.InteropServices.Marshal.
    GetActiveObject("VisualStudio.DTE.10.0");

foreach (Project project in dte.Solution.Projects)
{
    foreach(ProjectItem pi in project.ProjectItems)
    {
         listView1.Items.Add(pi.Name.ToString());
    }
}

This seems to work, but it populates the list with the contents of the solution with the package, and not with the experimental instance that starts when it starts. Am I creating the link incorrectly?

+5
source share
2 answers

The GetActiveObject method returns the first instance of the DTE process, not the calling DTE. (in the Visual Studio SDK 2010 project on Visual Studio 2010, type F5 may not work for the experimental hive)

...

+1

All Articles