8

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 ?

Libor
  • 3,285
  • 1
  • 33
  • 41
  • Who says there has to be an EnvDTE110? –  Aug 26 '12 at 16:52
  • @Will I have clarified the question a bit. – Libor Aug 27 '12 at 09:45
  • I think the question you might be wanting to ask is "I want to do X to the new feature Y in 2012, but I can't do it with EnvDTE100. How can I do this?" [EnvDTE is only one of many extensibility points within Visual Studio.](http://msdn.microsoft.com/en-us/library/bb165789(v=vs.110).aspx) –  Aug 27 '12 at 11:02
  • @Will Okay. I made a [similar question](http://stackoverflow.com/questions/7448636/install-custom-control-in-vs-toolbox) year ago, but no one knew. VSPackage did not work because of some nasty "Package Load Key" problem, so the EnvDTE was finally the only feasible option. But even EnvDTE is now a problem. – Libor Aug 27 '12 at 12:57
  • No more package load keys since 2008, so revisit that solution. –  Aug 27 '12 at 13:38

2 Answers2

15

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.

  • Thanks for clarifying that. The main problem is that I develop VS Toolbox components and the installer lets you decide in which versions of VS you want the component to integrate. If I use just EnvDTE100, then the component would be either integrated only in VS 2010 or in both 2010 and 2012. But what if user wants to integrate just in VS 2012 (using EnvDTE) ? It seems that the only way how to target specific version of Visual Studio is to use VSPackages... – Libor Aug 27 '12 at 12:52
7

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);
Libor
  • 3,285
  • 1
  • 33
  • 41
  • When i try to run this, the typeDTE is null. What else do I have to do/reference to make this work please? thanks – Stu Harper Nov 28 '13 at 09:00
  • Most probably the Visual Studio 2012 is not installed. But I have not encountered this yet. – Libor Nov 29 '13 at 08:54