سؤال

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 currently 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.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top