问题
Until now, I have been successfully using EnvDTE to manage Visual Studio Toolbox.
There are customized DLLs to deal with different Visual Studio versions:
EnvDTE.dll - common VS automation (probably works on all versions)
EnvDTE80.dll - to deal with VS 2005
EnvDTE90.dll - to deal with VS 2008
EnvDTE100.dll - to deal with VS 2010
However, there is no EnvDTE110 for VS 2012. Does that mean these is different way of VS automation than using these COM wrapper libraries?
If so, how to for example work with VS 2012 projects and Toolbox remotely other way than using EnvDTE ?
回答1:
I think you are misunderstanding how EnvDTE versioning works.
Visual Studio is backwards compatible with every version of EnvDTE. But if a new version of Visual Studio requires or exposes additional extensibility, then MS releases a newer version of EnvDTE that exposes this through its interfaces.
So, for example, you could use EnvDTE80 classes to interact with Visual Studio 2012. You are just limited to the extensibility that was available in Visual Studio 2005. Or you could use EnvDTE90, and be limited to that which was available when Visual Studio 2008 came out.
If a newer version of EnvDTE has not been released with the latest VS SDK, then you are limited to EnvDTE100.
回答2:
Although only envdte100.dll exists in
c:\Program Files (x86)\Common Files\microsoft shared\MSEnv\PublicAssemblies\
the following works for Visual Studio 2012:
Type typeDTE = typeDTE = Type.GetTypeFromProgID("VisualStudio.DTE.11.0");
DTE objDTE = (DTE)Activator.CreateInstance(typeDTE, true);
来源:https://stackoverflow.com/questions/12119667/envdte-substitute-in-visual-studio-2012