EnvDTE substitute in Visual Studio 2012

2020-02-23 20:57发布

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 ?

2条回答
霸刀☆藐视天下
2楼-- · 2020-02-23 21:23

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);
查看更多
家丑人穷心不美
3楼-- · 2020-02-23 21:28

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.

查看更多
登录 后发表回答