Loading

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);
posted @ 2011-08-25 14:13  today4king  阅读(294)  评论(0编辑  收藏  举报