I am these days trying to create a single .NET application that can automate all the Visual Studio versions installed on a machine (from Visual Studio .NET 2002 to Visual Studio 2010). For that purpose I have created a .NET application using Visual Studio .NET 2002 so it uses .NET Framework 1.0, which can run on any .NET Framework. Since I want to use early binding, I need to add a reference to EnvDTE.dll. And here I have found a problem; it happens that there are two versions of EnvDTE.Dll:
- Version 7.0.3300.0: it is installed by Visual Studio .NET 2002 and 2003, but not by Visual Studio 2005 or higher.
- Version 220.127.116.11: it is installed by Visual Studio 2005 or higher, but not by Visual Studio .NET 2002 or 2003.
So, depending on the Visual Studio versions installed, you can have one version, the other, or both.
If the ,NET application references version 18.104.22.168, it won’t work when only Visual Studio .NET 2002 or 2003 are installed. If it references version 7.0.3300.0, it won’t work when only Visual Studio 2005 or higher is installed. Using a .config file to redirect version 7.0.3300.0 to 22.214.171.124 won’t help, because if the system has only version 7.0.3300.0 installed, after the redirection it won’t find version 126.96.36.199.
That means that you can’t automate all Visual Studio versions starting with Visual Studio .NET 2002 or 2003 using early binding. You have to use late binding, either using Option Strict Off (VB.NET) or Reflection (VB.NET / C#).
I have updated accordingly the article that I wrote back in 2005:
HOWTO: Automating Visual Studio .NET from outside the IDE