how to get visual c# express application instance

1

I am using visual c# express edition and i want to create that application instance to get output window object.So i have used below code for creating visual studio instance.

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

but this is giving exeception :

Invalid class string (Exception from HRESULT: 0x800401F3 (CO_E_CLASSSTRING))

so please help me out.

c#
visual-studio-2010
asked on Stack Overflow Mar 16, 2011 by user591790 • edited Dec 19, 2011 by Joel Coehoorn

1 Answer

0

For Visual Studio 2013 Express, then the following works:

DTE2 dte = (DTE2)System.Runtime.InteropServices.Marshal.GetActiveObject("WDExpress.DTE.12.0");

In more generality, you can search for all running objects using the approach in Get current visual studio instance (EnvDTE) in C#

answered on Stack Overflow Dec 11, 2014 by MarmotJam • edited May 23, 2017 by Community

User contributions licensed under CC BY-SA 3.0