开发者

Get active Visual Studio object

开发者 https://www.devze.com 2023-01-21 03:47 出处:网络
using this code I get the object representing Visual Studio: var dte2 = Marshal.GetActiveObject(\"VisualStudio.DTE.10.0\") as DTE2;

using this code I get the object representing Visual Studio:

var dte2 = Marshal.GetActiveObject("VisualStudio.DTE.10.0") as DTE2;

However, when I have multiple instances of VS opened, this returns any instance of VS, not the one I am curren开发者_C百科tly executing the code from.

I am not within an add-in so I don't have access to the applicationObject.

How can I get the current Visual Studio instance??

Thanks a lot.


Try pulling the Active Window Handle (Foreground Window) with the Windows API's.

0

精彩评论

暂无评论...
验证码 换一张
取 消