When you develop a solution for a Microsoft Office 2003 application by using Microsoft Visual Studio .NET 2003, and you reference an Office object library in that solution, you notice that Visual Studio .NET 2003 creates an Interop Assembly (IA) for the library instead of referencing the Primary Interop Assembly (PIA).
Additionally, there is another symptom of this same problem. When you try to create a new Office project by using Microsoft Visual Studio Tools for the Microsoft Office System 2003, you receive the following error message:
The primary interop assembly required by this project is not installed in the global assembly cache. Microsoft Office 2003 includes the primary interop assemblies for each application as an installation option. For details on installing the Office primary interop assemblies, see the Help topic, "Installing Office Primary Interop Assemblies."
This problem may occur for either of the following reasons:
The PIA for the Office object library that you select is not installed in the Global Assembly Cache (GAC).
To install the PIA in the GAC, you must have the PIA for the Office application or the PIA for the Office component marked as Run from My Computer in Microsoft Office 2003 Setup. In Office Setup, each Office PIA is listed under the corresponding application for the PIA as a .NET Programmability Support feature.
The PIA is installed in the GAC, but a registry entry is missing.
When you select a reference to an Office object library in the development environment, Visual Studio .NET uses the registry to locate the PIA that corresponds to the object library that you select. This registry entry may be removed if the Office object library of the application is registered by a newly installed program or sometimes if the application executable for that object library is run with the regserver switch.
To resolve this problem, Microsoft recommends that you run Office Setup from Add or Remove Programs in Control Panel:
If the PIA does not appear in the GAC, run Office Setup and then mark the PIA for the application as Run from My Computer. Each Office PIA appears as a .NET Programmability Support feature for the corresponding Office application or for the corresponding Office component.
If the PIA does appear in the GAC, run Office Setup and then select the option to repair your Office installation. Alternatively, if the PIA does appear in the GAC, you can run the regasm utility to restore the missing registry entries.
In Control Panel, double-click Administrative Tools, and then select Microsoft .NET Framework 1.1 Configuration.
Select Assembly Cache, and then click Assemblies on the View menu.
Right-click Assembly in the Assemblies list, and then click Properties.
In the Assembly Properties dialog box, notice the Assembly Name, the Version, and the Public key token.
For example, if you select the Microsoft Word PIA, you notice the following property values:
Assembly Name: Microsoft.Office.Interop.Word Version: 22.214.171.124 Public Key Token: 71e9bce111e9429c
Start a Visual Studio .NET command prompt.
At the command prompt, change to the directory where the assembly is located.