I have a Visual Studio 2010 extension, a .vsix file. I can get a DTE instance for my specific instance of Visual Studio, which I confirm by typing dte_instance.Solution.Fullname. But for my DTE2 instance, it seems to give me information about the wrong instance of Visual Studio.
Here is the workflow: Visual Studio IDE development environment is open, has code for extension. Run the project, which starts the instance of Visual Studio in which the extension is installed. Press my menu button (in the new IDE), which runs the following code:
DTE dte; DTE2 dte2, dte2Macros; dte = (DTE)GetService(typeof(DTE)); dte2 = (DTE2)System.Runtime.InteropServices.Marshal.GetActiveObject("VisualStudio.DTE.10.0"); dte2Macros = (DTE2)dte2.MacrosIDE;
I found some links to purchasing a DTE2 object in the add-on using the connect () method, but I could not find a similar callback for extensions.
Question: how to get a DTE2 instance for the IDE in which the extension is running?
Adam source share