Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio Extensibility Package not looking at correct project

I have created a new VS 2010 extensibility package. So far, all I want to do is have the user press a button and fill a listview with the entire 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 does seem to work, however, it populates the list with the contents of the solution with the package in it and not the experimental instance that is launched when this is run. Am I instantiating the reference wrongly?

like image 737
Paul Michaels Avatar asked Nov 13 '22 16:11

Paul Michaels


1 Answers

GetActiveObject method returns first process instance of DTE, not caller DTE. (in Visual Studio SDK 2010 project on Visual Studio 2010, type F5 to execure experimental hive may fail)

Look at here and here for more details...

like image 187
CharithJ Avatar answered May 12 '23 10:05

CharithJ