Office 2003 Primary Interop Assemblies (PIAs) [Office 2003 SDK Documentation]

<Drive><Drive>

The Office 2003 Primary Interop Assemblies (PIAs) if successfully installed will be in the Global Assembly Cache (GAC) in <Drive>:/WINDOWS/assembly or <Drive>:/WINNT/assembly. If for example, the smart tag PIA is installed in the GAC, you will see Microsoft.Office.Interop.SmartTag, version 11.0.0.0, public key token 71e9bce111e9429c in the GAC. If you don't see it, then it means you somehow didn't manage to install the PIAs.

Note  If you don't know what PIAs are, see the Primary Interop Assemblies (PIAs) and Interop Assemblies (IAs) topic for more information.

Where and How to get the Office 2003 PIAs?

The .NET Framework v1.1 is required. If you don't have the .NET Framework v1.1 already installed when you install Office 2003, the PIAs will not be installed. Additionally, the option to install the PIAs doesn't show up in the Custom setup for Office. If you have the .NET Framework v1.1 installed, then you will see something like .NET Programmability Support in the list of options.

If you do a complete install of Office 2003, you'll get the PIAs installed into the GAC automatically. It's strongly recommended that you do a complete install. With a typical install, the PIAs are installed on demand.

Note  If you are doing development work, don't do a typical install of Office 2003 if you want the PIAs. There is a known bug in Visual Studio .NET and Visual Studio 2003 where if PIAs are set to install on demand in a typical install, or install on first use for custom install, when you reference an Office COM type library, you could end up getting an interop assembly (IA). To avoid this issue, make sure the Office 2003 PIAs that you need to reference are already installed into the GAC before you start any development work. However, on end user machines where no development work needs to take place, it's okay to do a typical install of Office 2003 on their machines.

If you install the .NET Framework v1.1 only after you've installed Office 2003, to get the PIAs after that, you would need to rerun Office setup.

1. Then select Add or Remove Features, and click Next.

2. Select the Choose advanced customization of applications check box and click Update.

3. Expand the Office Tools node, select Smart Tag .NET Programmability Support to get the smart tag PIA . Make sure you choose Run from My Computer. Do not choose install on first use.

4. To install other Office 2003 application specific PIAs, expand that particular application nodes and select .NET Programmability Support to install the application specific PIAs. Again, make sure you choose Run from My Computer. Do not choose install on first use.

How to reference a Smart Tag\Application Specific PIAs

1. Open the .sln file in Visual Studio .NET or Visual Studio 2003.

2. Then in the Solution Explorer, expand the References node.

3. Right click on References and click Add References. This displays the Add reference dialog box.

4. Click on the COM tab.

5. From the Component Name list, scroll down to Microsoft Smart Tags 2.0 Type Library. Highlight it and click Select. You will see it listed in the Selected Components list in the same dialog box.

6. Click OK. You should see SmartTagLib now in the References node in the Solution Explorer.

7. If you highlight the SmartTagLib and look at its properties in the properties window, the Copy Local property should say False. And the path property should point to its location in the GAC including its version number: 11.0.0.0. On a Windows XP operating system, it looks something like:

C:\WINDOWS\assembly\GAC\Microsoft.Office.Interop.SmartTag

\11.0.0.0__71e9bce111e9429c\Microsoft.Office.Interop.SmartTag.dll

8. To add reference to other Office 2003 type libraries, repeat steps 3 to 7. In Step 5, choose the appropriate application type library.

How do you know if you are referencing the PIAs correctly?

To know if you've done it correctly, check to make sure the SmartTagLib's Copy Local property is False and the Path property, on a Windows XP machine, is something like:

C:\WINDOWS\assembly\GAC\Microsoft.Office.Interop.SmartTag

\11.0.0.0__71e9bce111e9429c\Microsoft.Office.Interop.SmartTag.dll

If the Copy Local property in the Properties window is set to True, your solution is not referencing the smart tag PIA but and interop assembly (IA) instead.

Best practice is to always use the official PIAs. You should then remove the IA and re-reference again. To remove an IA, right click on the IA and click Remove. Resolving it this way only works if you didn't do install on first use but run from my computer or did a complete install (see "Where and How to get the Office 2003 PIAs? " topic discussed above on why this matters). If you know you have the Office 2003 PIAs in the GAC, but somehow you keep getting IA and not the PIA instead, it could mean some type library registration has broken that specific PIA registration.

To fix this, you can do any of the following:

1. do an Office repair

2. re-install the affected PIA. To do this, rerun Office setup (see "Where and How to get the Office 2003 PIAs? " topic discussed above on how to custom install an Office 2003 PIA).

3. RegAsm that particular PIA from the GAC to re-register that PIA. For example, to RegAsm the smart tag PIA (the namespace for the SmartTagLib PIA is Microsoft.Office.Interop.SmartTag), type the following lines as a single command without line breaks and press ENTER:

%systemroot%\Microsoft.NET\Framework\v1.1.4322\RegAsm.exe 
%systemroot%\assembly\GAC\Microsoft.Office.Interop.SmartTag
\11.0.0.0__71e9bce111e9429c\Microsoft.Office.Interop.SmartTag.dll

To RegAsm the Office PIA (the Office PIA's namespace is Microsoft.Office.Core), type the following lines as a single command without line breaks and press ENTER:

%systemroot%\Microsoft.NET\Framework\v1.1.4322\RegAsm.exe 
%systemroot%\assembly\GAC\Office
\11.0.0.0__71e9bce111e9429c\Office.dll

To RegAsm the VBIDE PIA (the VBIDE PIA's namespace is Microsoft.Vbe.Interop), type the following lines as a single command without line breaks and press ENTER:

%systemroot%\Microsoft.NET\Framework\v1.1.4322\RegAsm.exe 
%systemroot%\assembly\GAC\Microsoft.Vbe.Interop
\11.0.0.0__71e9bce111e9429c\Microsoft.Vbe.Interop.dll

This sort of check on correct referencing of PIAs can be applied to other Office PIAs.

Deployment

No solution setup package should try to re-distribute the Office 2003 PIAs in any way. Office 2003 should be the only Office 2003 PIAs delivery mechanism. Office 2003 PIAs can be installed automatically to the GAC or install on demand on end users machines through complete, typical or custom installs.

Be sure not to include the PIAs in your setup. Including the Office 2003 PIAs in your setup project will potentially break Office 2003 ownership and registration of the PIA components on end-user machines. This would cause them to inadvertently be removed on an end-user machine during an uninstall.

For example, when users install the setup package, the Office 2003 PIAs that are packaged into the setup will overwrite the registration of already installed components. And when users uninstall their solution, those PIA registration could be broken, thus leaving the users' machines without .NET programmability support for those components.

Note  Visual Studio .NET and Visual Studio 2003 setup project usually automatically include some of the PIAs in the setup package. So developers need to be sure to exclude the Office 2003 PIAs from their setup package.

stdole.dll, adodb.dll and msdatasrc.dll PIAs

Unlike in Office XP, stdole.dll, adodb.dll and msdatasrc.dll PIAs are shipped in Office 2003. So, like all Office 2003 PIAs, developers should not re-distribute them.

What PIAs do you get with minimum install

The following five PIAs are installed by default even in typical\minimum install of Office 2003 when .NET Framework v1.1 is present:

Stdole.dll

Adodb.dll

Msdatasrc.dll

Microsoft.Vbe.Interop.dll

Office.dll

Additionally, if you install Access or Office Web Components 2003, the mscomctl PIA will also be available in minimum install.