Code中获取VS对象
(EnvDTE.DTE)System.Runtime.InteropServices.Marshal.GetActiveObject("VisualStudio.DTE.10.0")
这里90对应2008
应用如获取解决方案目录:
string solutionDirectory = ((EnvDTE.DTE)System.Runtime
.InteropServices
.Marshal
.GetActiveObject("VisualStudio.DTE.10.0"))
.Solution
.FullName;
solutionDirectory = System.IO.Path.GetDirectoryName(solutionDirectory);