With the upcoming release of Visio 2007, I’ve had a number of questions recently about the .Net Primary Interop Assemblies (PIA) and how to make a managed COM add-in that works across different versions of Visio.

First, a brief history. If you have no idea what I am talking about, you can take a look at the following intro on MSDN: Primary Interop Assemblies and Interop Assemblies. I’ll be discussing Visio here but the story is pretty much the same for all of Office. PIAs were first introduced as a separate download after Visio 2002 shipped. Then, with the release of Visio 2003 the PIAs began to ship in the box and new ones will ship in Visio 2007.

Given all that, what does it mean for building apps that will work across versions. This is the basic story:

  • Apps written against the Visio 2002 PIAs are not compatible with either the Visio 2003 or 2007 ones.
  • Apps written against the Visio 2003 PIAs are forward compatible with Visio 2007.

If you want your application to work for Visio 2002 and forward, you will need to compile two different versions, one for Visio 2002 and one for Visio 2003/7. Then, set up your installer to detect the version of Visio that the user has installed and install the right version for that user.

Some more information on the PIAs: