Office 2003 Primary Interop Assembly Tips and Tricks

Unlike the PIAs for Office XP, the PIAs for Office 2003 ship in-the-box, and are not available as a separate download.  To ensure they get installed by the Office installer during setup you need to make sure that the .NET Framework 1.1 is already installed on your machine (v1.0 won't help you here).  This is because the PIAs are installed into the GAC and without the framework, there is nowhere for them to go!  You can make life easier for yourself by ensuring that you install the .NET Framework first, but even if you install the Framework later, you can still add the PIAs by running Office setup from Control Panel, Add/Remove Programs.  In the Office installer choose custom setup and in the tree view navigate through the tree ensuring all the items named .NET Programmability Support are configured to run from hard disk.  There are about 6 of these items.

 

You're now ready to start writing managed addins, smart tags and smart docs.  Kinda confusing though, in Visual Studio.NET when you choose Add Reference you still select the Office library you want to reference from the COM tab of the dialog rather than the .NET tab.  A reference to the appropriate PIA is then added to the project.

 

If you want to write managed code to work with both Office XP and Office 2003, you'll need to create separate versions that compile against each of the sets of PIAs.

 

Help! My PIA's seem to have disappeared.

On several occasions I have seen that one or more of the Office 2003 PIAs have become unregistered causing Visual Studio to be unable to compile an Office Interop solution.  This tends to occur when a hotfix has been applied from Windows Update or Office Update.  If you find this happens to you, the simple cure is to go back to Add/Remove Programs and in Office Setup choose the Repair option.

 

Deployment

Never attempt to distribute the Office 2003 PIAs yourself with your addin.  Apart from the fact that the licence doesn't permit this, there is no need to do this as the Office Setup program by default configures them to install on first use.