2011-03-16 35 views
1

我正在使用visual c# express edition,我想創建該應用程序實例以獲取輸出窗口對象。因此,我使用下面的代碼來創建visual studio實例。如何獲得visual c#express應用程序實例

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

但這是給exeception:

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

所以請幫助我。

回答

0

對於Visual Studio 2013 Express中,那麼以下工作:

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

在更一般的情況,你可以在Get current visual studio instance (EnvDTE) in C#

使用方法所有正在運行的搜索對象
相關問題