I am trying to create a Visual Studio instance using :
EnvDTE80.DTE2 dte2;
dte2 = (EnvDTE80.DTE2)System.Runtime.InteropServices.Marshal.GetActiveObject("VisualStudio.DTE.12.0");
And I am always having the exception "Invalid Class String" so I assume that the problem is "VisualStudio.DTE.12.0". But I am working on Visual Studio 2013 12.0.30501, I also tried to put only "VisualStudio.DTE" to get the most recent version, and same exception.
Also, I tried the other way :
Type t = Type.GetTypeFromProgID("VisualStudio.DTE.12.0", true);
dte2 = (EnvDTE80.DTE2)System.Activator.CreateInstance(t, true);
The problem is still there, I am running a bit out of idea... Is it really an invalid string error ?