Installing and Using the Office 2003 Primary Interop Assemblies
Siew Moi Khor
Microsoft Office 2003
Note This article was updated on April 25, 2005. The Office 2003 Update: Redistributable Primary Interop Assemblies is now available for download.
Summary: Learn how to get and install the Office 2003 primary interop assemblies (PIAs), and how to reference and troubleshoot them. (11 printed pages)
Getting the Office 2003 PIAs
Installing the Office 2003 PIAs
Using the Office 2003 PIAs
In Microsoft Office 2003, you can work with COM objects exposed by the Office applications by using a primary interop assembly (PIA). In this article, find out how to get, install, and reference the PIAs.
You can find details about PIAs and interop assemblies and how to program against the interfaces and classes exposed by Office 2003 in managed code from a number of articles on the subject. For information about PIAs, interop assemblies, and their uses, see Primary Interop Assemblies (PIAs) and A Primer to the Office XP Primary Interop Assemblies.
See Additional Resources for a list of articles that give detailed information about classes and interfaces exposed by Office to managed code.
Getting the Office 2003 PIAs
The following tables list the PIAs available for use with Office 2003. Table 1 lists Microsoft Office 2003 applications and component type libraries that have the same version number and that are signed with the same key. The version number for these applications is 188.8.131.52, and the public key token is 71e9bce111e9429c.
Table 2 lists Office 2003 applications and component type libraries that have different version numbers and that are signed with different keys from those in Table 1.
Table 3 lists the PIAs provided by Microsoft Visual Studio .NET 2003 and included in the Office 2003 family of products.
Table 1. Office 2003 applications and component type libraries with the same version number, signed with the same key
|Office 2003 Application or Component||Primary Interop Assembly Name||Primary Interop Assembly Namespace|
|Microsoft Access 11.0 Object Library||Microsoft.Office.Interop.Access.dll||Microsoft.Office.Interop.Access|
|Microsoft Excel 11.0 Object Library||Microsoft.Office.Interop.Excel.dll||Microsoft.Office.Interop.Excel|
|Microsoft Forms 2.0 Object Library||Microsoft.Vbe.Interop.Forms.dll||Microsoft.Vbe.Interop.Forms|
|Microsoft FrontPage 6.0 Page Object Reference Library||Microsoft.Office.Interop.FrontPageEditor.dll||Microsoft.Office.Interop.FrontPageEditor|
|Microsoft FrontPage 6.0 Web Object Reference Library||Microsoft.Office.Interop.FrontPage.dll||Microsoft.Office.Interop.FrontPage|
|Microsoft Graph 11.0 Object Library||Microsoft.Office.Interop.Graph.dll||Microsoft.Office.Interop.Graph|
|Microsoft InfoPath 1.0 Type Library||Microsoft.Office.Interop.InfoPath.dll||Microsoft.Office.Interop.InfoPath|
|Microsoft Office 11.0 Object Library||Office.dll||Microsoft.Office.Core|
|Microsoft Office Outlook View Control||Microsoft.Office.Interop.OutlookViewCtl.dll||Microsoft.Office.Interop.OutlookViewCtl|
|Microsoft Office Web Components 11.0||Microsoft.Office.Interop.Owc11.dll||Microsoft.Office.Interop.Owc11|
|Microsoft Outlook 11.0 Object Library||Microsoft.Office.Interop.Outlook.dll||Microsoft.Office.Interop.Outlook|
|Microsoft PowerPoint 11.0 Object Library||Microsoft.Office.Interop.PowerPoint.dll||Microsoft.Office.Interop.PowerPoint|
|Microsoft Project 11.0 Object Library||Microsoft.Office.Interop.MSProject.dll||Microsoft.Office.Interop.MSProject|
|Microsoft Publisher 11.0 Object Library||Microsoft.Office.Interop.Publisher.dll||Microsoft.Office.Interop.Publisher|
|Microsoft SmartTag 2.0 Type Library||Microsoft.Office.Interop.SmartTag.dll||Microsoft.Office.Interop.SmartTag|
|Microsoft Visio 11.0 Type Library||Microsoft.Office.Interop.Visio.dll||Microsoft.Office.Interop.Visio|
|Microsoft Visual Basic 6.0 Extensibility||Microsoft.Vbe.Interop.dll||Microsoft.Vbe.Interop|
|Microsoft Word 11.0 Object Library||Microsoft.Office.Interop.Word.dll||Microsoft.Office.Interop.Word|
Table 2. Office 2003 applications and component type libraries with a different version number, signed with a different key
|Object Library||Primary Interop Assembly Name||Version Number||Public Key Token|
|Microsoft DAO 3.6 Object Library||Dao.dll||10.0.4504.0||31bf3856ad364e35|
|Microsoft Windows Common Controls 6.0||Mscomctl.dll||10.0.4504.0||31bf3856ad364e35|
Table 3. PIAs provided by Visual Studio .NET 2003 and included in Office 2003
|Object Library||Primary Interop Assembly Name||Version Number||Public Key Token|
|Microsoft ActiveX Data Objects 2.5–2.8 Library||Adodb.dll||7.0.3300.0||b03f5f7f11d50a3a|
|Microsoft Data Source Interfaces||Msdatasrc.dll||7.0.3300.0||b03f5f7f11d50a3a|
Getting the Office 2003 PIAs When Installing .NET Framework 1.1 Before Installing Office 2003
To get the Office PIAs along with your installation of Microsoft Office 2003, you must first install Microsoft .NET Framework version 1.1. If you do not install .NET Framework 1.1 before you install Office 2003, the PIAs are not installed with your Office 2003 installation.
If you install .NET Framework 1.1 after you have installed Office 2003, you can still install the PIAs by following the steps outlined in Getting the Office 2003 PIAs When Installing .NET Framework 1.1 After Installing Office 2003.
If you do not install .NET Framework 1.1 before you install Office 2003, the option to install the PIAs does not show up in the custom setup for Office. If you install .NET Framework 1.1 first, you see .NET Programmability Support in the list of options available in the custom setup, as shown in Figure 1.
Figure 1. The .NET Programmability Support option in the Office 2003 setup (click picture to see larger image)
Getting the Office 2003 PIAs When Installing .NET Framework 1.1 After Installing Office 2003
If you install Microsoft .NET Framework version 1.1 after you install Microsoft Office 2003, to get the PIAs, you must modify your Office setup.
To modify the Office 2003 setup
In the Maintenance Mode Options screen of the MicrosoftOffice 2003 Setup dialog box, select Add or Remove Features, as shown in Figure 2, and click Next.
Figure 2. Modifying the Office 2003 setup (click picture to see larger image)
Select the Choose advanced customization of applications check box and click Next.
Expand the application-specific node. For example, to get the Microsoft Office Excel 2003 PIA, expand the Microsoft Office Excel node and select .NET Programmability Support. Click the drop-down arrow next to .NET Programmability Support to select update options, and choose Run from My Computer, as shown in Figure 3. Do not choose Installed on First Use.
Figure 3. Selecting update options for .NET Programmability Support (click picture to see larger image)
Note Selecting Run from My Computer means you want the currently selected feature—for example, .NET Programmability Support—to be installed and stored on your hard disk. Selecting Run all from My Computer means you want the currently selected feature and all of its subfeatures installed and stored on your hard disk. The .NET Programmability Support feature has no subfeatures, so selecting either Run from My Computer or Run all from My Computer gives the same results. Selecting Installed on First Use means you only want the .NET Programmability Support feature installed on your hard disk when you use the feature for the first time. In this case, you may need access to the compact disk or network server you used to install Office 2003 in order to install the .NET Programmability Support feature.
To install other Office 2003 application-specific PIAs, expand the application node and select .NET Programmability Support.
To install Smart Tag .NET Programmability Support, Microsoft Forms 2.0 .NET Programmability Support, or Microsoft Graph .NET Programmability Support, expand the Office Tools node, and select the appropriate .NET Programmability Support, as shown in Figure 4. Again, make sure you choose Run from My Computer if you are installing on a development computer. Do not choose Installed on First Use.
Figure 4. Office Tools node .NET Programmability Support options (click picture to see larger image)
Installing the Office 2003 PIAs
Installing the PIAs with a Typical Install of Office 2003
If Microsoft .NET Framework version 1.1 is present, the following five PIAs are installed by default with a typical install of Microsoft Office 2003:
If Microsoft Access or Microsoft Office Web Components 2003 is present, the Mscomctl.dll PIA is also installed by default.
Installing the PIAs with a Complete Install of Office 2003
If you do a complete, rather than a typical, install of Microsoft Office 2003, the PIAs are installed into the global assembly cache automatically. If you are installing the PIAs on a development computer, you should do a complete install. With a typical install, the PIAs are installed on demand.
Note On development machines, you should not do a typical install of Office 2003 if you want the PIAs. There is an issue in Microsoft Visual Studio .NET and Microsoft Visual Studio .NET 2003 that could result in creation of a Visual Studio–generated interop assembly when referencing a COM object whose PIA is set to install on demand. To avoid this issue, make sure the Office 2003 PIAs you want to reference are installed in the global assembly cache before you start any development work. On machines where no development work will take place, it's okay to do a typical install of Office 2003. The steps for a custom Office setup are the same as those described in Getting the Office 2003 PIAs When Installing .NET Framework 1.1 After Installing Office 2003.
Finding the Office 2003 PIA Installation Location
The Microsoft Office 2003 Primary Interop Assemblies (PIAs) are installed in the global assembly cache in drive:/WINDOWS/assembly or drive:/WINNT/assembly.
For example, if the Microsoft Office Excel 2003 PIA is installed in the global assembly cache, you will see the global assembly name, Microsoft.Office.Interop.Excel, version 184.108.40.206, and the public key token, 71e9bce111e9429c, in the global assembly cache, as shown in Figure 5. If you don't see them, then the Excel PIA was not installed.
Figure 5. Office 2003 PIAs installed in the global assembly cache (click picture to see larger image)
Using the Office 2003 PIAs
Referencing an Office 2003 Managed Code–Type PIA
You can reference one or more of the Office 2003 PIAs by using the following procedure.
To reference an Office 2003 managed code–type PIA
Open your managed code solution (.sln) file in Microsoft Visual Studio .NET or Microsoft Visual Studio .NET 2003.
In the Solution Explorer window, expand the References node.
Right-click References,****and click Add References to open the Add reference dialog box, shown in Figure 6.
Click the COM tab.
Figure 6. Add Reference dialog box with the COM tab selected (click picture to see larger image)
In the Component Name list, scroll down to the object type library you want to reference. For example, in Figure 6, Microsoft Office 11.0 Object Library is selected.
Highlight the component and click Select. You will see it listed in the Selected Components list box at the bottom of the tab.
Click OK. You should see Microsoft.Office.Core added to the References node in the Solution Explorer,****as shown in Figure 7.
Figure 7. Microsoft.Office.Core PIA added to References
If you highlight the Microsoft.Office.Core reference and look at its properties in the Properties window, the Copy Local property should be set to False. The Path property should point to its location in the global assembly cache and should include its version number: 220.127.116.11. On a Microsoft Windows XP operating system, it looks something like the following:
To add a reference to other Office 2003 type libraries, repeat steps 3 through 7. In Step 5, choose the application or component object type library you want to reference.
Verifying References to the Office 2003 PIAs
To know if you've referenced a PIA correctly, make sure the Copy Local property for the PIA is set to False. On a Windows XP operating system, the Path property should appear as follows if you are referencing, for example, a Microsoft Office 2003 Smart Tag PIA:
If the Copy Local property in the Properties window is set to True, your solution is not referencing the Smart Tag PIA but an interop assembly instead. Because the best practice is to use the official PIAs, you should remove the interop assembly and reference the PIA again. To remove an interop assembly, in the References node, right-click the interop assembly name and click Remove.
Note Removing the interop assembly and referencing the PIA again works only if you chose Run from My Computer rather than Installed on First Use as the update option for the PIA, or if you did a complete install of Office 2003. For more information on why this matters, see Getting the Office 2003 PIAs When Installing .NET Framework 1.1 After Installing Office 2003.
If you know you have the Office 2003 PIAs in the global assembly cache, but somehow you keep getting an interop assembly and not the PIA, it could mean some type library registration has corrupted that specific PIA registration. To fix PIA registration problems, see Differentiating Between PIAs and Interop Assemblies.
Differentiating Between PIAs and Interop Assemblies
If you can see the Microsoft Office 2003 PIAs in the global assembly cache, but somehow you keep getting an interop assembly and not the PIA when you reference the Office application or component object type library, it could mean some other type library registration has corrupted that specific PIA registration. To fix the PIA registration, you can do any of the following:
Note You should install Microsoft Office 2003 Service Pack 1 from Microsoft Office Downloads before attempting any of the options that follow.
Conduct an Office repair.
Reinstall the affected PIA. To do this, rerun Office setup (see Getting the Office 2003 PIAs When Installing .NET Framework 1.1 After Installing Office 2003).
From the global assembly cache, run the RegAsm tool on the affected PIA to re-register it. For example, run RegAsm on the Office PIA (the Office PIA namespace is Microsoft.Office.Core), as follows:
%systemroot%\Microsoft.NET\Framework\v1.1.4322\RegAsm.exe %systemroot%\assembly\GAC\Office\18.104.22.168__71e9bce111e9429c\ Office.dll
To run RegAsm on the VBIDE PIA (the VBIDE PIA namespace is Microsoft.Vbe.Interop):
%systemroot%\Microsoft.NET\Framework\v1.1.4322\RegAsm.exe %systemroot%\assembly\GAC\Microsoft.Vbe.Interop\ 22.214.171.124__71e9bce111e9429c\Microsoft.Vbe.Interop.dll
To run RegAsm on the Microsoft Office Excel 2003 PIA (the Excel PIA namespace is Microsoft.Office.Interop.Excel):
%systemroot%\Microsoft.NET\Framework\v1.1.4322\RegAsm.exe %systemroot%\assembly\GAC\Microsoft.Office.Interop.Excel\ 126.96.36.199__71e9bce111e9429c\ Microsoft.Office.Interop.Excel.dll
To run RegAsm on the Microsoft Office 2003 Smart Tag PIA (the namespace for the Smart Tag PIA is Microsoft.Office.Interop.SmartTag):
%systemroot%\Microsoft.NET\Framework\v1.1.4322\RegAsm.exe %systemroot%\assembly\GAC\Microsoft.Office.Interop.SmartTag\ 188.8.131.52__71e9bce111e9429c\Microsoft.Office.Interop.SmartTag.dll
Redistributing the Office 2003 PIAs
The only supported redistribution method is to use the Office 2003 Update: Redistributable Primary Interop Assemblies.
Redistributing the Stdole.dll, Adodb.dll, and Msdatasrc.dll PIAs
Unlike with Microsoft Office XP, the Stdole.dll, Adodb.dll, and Msdatasrc.dll PIAs are included with Microsoft Office 2003, as shown in Table 3. As with all Office 2003 PIAs, the only supported redistribution method is to use the Office 2003 Update: Redistributable Primary Interop Assemblies.
Using the Office XP PIAs and the Office 2003 PIAs
PIAs are version specific, so you should use the same version of the PIAs as the application version. For example, if you want to migrate your Microsoft Office XP managed code solution to Microsoft Office 2003, you should recompile the Office XP managed code solution with Office 2003 PIAs.
You should also have two different setup packages—one for Office XP and another for Office 2003—if you intend for the same solution to work in both Office XP and Office 2003. Deployment of PIAs for Office XP is very different from that for Office 2003. For further information about these differences, see the ReadMe file included in the Office XP PIAs download.
Those who are interested in knowing more about programming for Microsoft Office 2003 with managed code, interfaces and co-classes exposed by Office in the PIAs, type information, and so forth, can explore the following books, articles, and downloads:
- Microsoft .NET Development for Microsoft Office (Office/Progmng/Net)
- Microsoft Office 2003 Service Pack 1 on Microsoft Office Downloads
- Microsoft Knowledge Base article: Information about designing Office XP add-ins and Office 2003 add-ins by using the .NET Framework
- Primary Interop Assemblies (PIAs)
- A Primer to the Office XP Primary Interop Assemblies
- Working with the Office XP Primary Interop Assemblies
- Office XP Primary Interop Assemblies Known Issues
- Microsoft Knowledge Base article: Microsoft Office XP Primary Interop Assemblies (PIAs) are available for download
- Office XP Primary Interop Assemblies (PIAs) download
- Coming to grips with the mess of types in the Office PIAs
- Excel PIAs: Who you calling Dummy--Dummy?
- Programming Microsoft Word 2002 and Excel 2002 with Microsoft Visual C#
- Programming Office Applications Using Microsoft Visual C#
- Understanding the Excel Object Model from a .NET Developer's Perspective
- Understanding the Word Object Model from a .NET Developer's Perspective
- An Introduction to Programming Outlook 2003 Using C#
- Developing .NET Smart Clients for Microsoft Office XP
- Introducing OfficeWiki.net - An experiment in community Office PIA documentation
- Problems when a Method and Event name are the same when using C#
- Isolating Office Extensions with the COM Shim Wizard