Export (0) Print
Expand All
Expand Minimize

Installing and Using the Office 2003 Primary Interop Assemblies

Office 2003
 

Siew Moi Khor
Art Leonard
Microsoft Corporation

January 2005

Applies to:
    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)

Contents

Introduction
Getting the Office 2003 PIAs
Installing the Office 2003 PIAs
Using the Office 2003 PIAs
Additional Resources

Introduction

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 11.0.0.0, 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 ComponentPrimary Interop Assembly NamePrimary Interop Assembly Namespace
Microsoft Access 11.0 Object LibraryMicrosoft.Office.Interop.Access.dllMicrosoft.Office.Interop.Access
Microsoft Excel 11.0 Object LibraryMicrosoft.Office.Interop.Excel.dllMicrosoft.Office.Interop.Excel
Microsoft Forms 2.0 Object LibraryMicrosoft.Vbe.Interop.Forms.dllMicrosoft.Vbe.Interop.Forms
Microsoft FrontPage 6.0 Page Object Reference LibraryMicrosoft.Office.Interop.FrontPageEditor.dllMicrosoft.Office.Interop.FrontPageEditor
Microsoft FrontPage 6.0 Web Object Reference LibraryMicrosoft.Office.Interop.FrontPage.dllMicrosoft.Office.Interop.FrontPage
Microsoft Graph 11.0 Object LibraryMicrosoft.Office.Interop.Graph.dllMicrosoft.Office.Interop.Graph
Microsoft InfoPath 1.0 Type LibraryMicrosoft.Office.Interop.InfoPath.dllMicrosoft.Office.Interop.InfoPath
Microsoft Office 11.0 Object LibraryOffice.dllMicrosoft.Office.Core
Microsoft Office Outlook View ControlMicrosoft.Office.Interop.OutlookViewCtl.dllMicrosoft.Office.Interop.OutlookViewCtl
Microsoft Office Web Components 11.0Microsoft.Office.Interop.Owc11.dllMicrosoft.Office.Interop.Owc11
Microsoft Outlook 11.0 Object LibraryMicrosoft.Office.Interop.Outlook.dllMicrosoft.Office.Interop.Outlook
Microsoft PowerPoint 11.0 Object LibraryMicrosoft.Office.Interop.PowerPoint.dllMicrosoft.Office.Interop.PowerPoint
Microsoft Project 11.0 Object LibraryMicrosoft.Office.Interop.MSProject.dllMicrosoft.Office.Interop.MSProject
Microsoft Publisher 11.0 Object LibraryMicrosoft.Office.Interop.Publisher.dllMicrosoft.Office.Interop.Publisher
Microsoft SmartTag 2.0 Type LibraryMicrosoft.Office.Interop.SmartTag.dllMicrosoft.Office.Interop.SmartTag
Microsoft Visio 11.0 Type LibraryMicrosoft.Office.Interop.Visio.dllMicrosoft.Office.Interop.Visio
Microsoft Visual Basic 6.0 ExtensibilityMicrosoft.Vbe.Interop.dllMicrosoft.Vbe.Interop
Microsoft Word 11.0 Object LibraryMicrosoft.Office.Interop.Word.dllMicrosoft.Office.Interop.Word

Table 2. Office 2003 applications and component type libraries with a different version number, signed with a different key

Object LibraryPrimary Interop Assembly NameVersion NumberPublic Key Token
Microsoft DAO 3.6 Object Library Dao.dll10.0.4504.031bf3856ad364e35
Microsoft Windows Common Controls 6.0 Mscomctl.dll10.0.4504.031bf3856ad364e35

Table 3. PIAs provided by Visual Studio .NET 2003 and included in Office 2003

Object LibraryPrimary Interop Assembly NameVersion NumberPublic Key Token
Microsoft ActiveX Data Objects 2.5–2.8 LibraryAdodb.dll7.0.3300.0b03f5f7f11d50a3a
Microsoft Data Source InterfacesMsdatasrc.dll7.0.3300.0b03f5f7f11d50a3a
OLE AutomationStdole.dll7.0.3300.0b03f5f7f11d50a3a

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.

Click here to see larger image

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

  1. In the Maintenance Mode Options screen of the Microsoft Office 2003 Setup dialog box, select Add or Remove Features, as shown in Figure 2, and click Next.

    Click here to see larger image

    Figure 2. Modifying the Office 2003 setup (click picture to see larger image)

  2. Select the Choose advanced customization of applications check box and click Next.
  3. 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.

    Click here to see larger image

    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.
  4. Click Update.
  5. 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.

    Click here to see larger image

    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:

  • Stdole.dll
  • Adodb.dll
  • Msdatasrc.dll
  • Microsoft.Vbe.Interop.dll
  • Office.dll

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 11.0.0.0, 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.

Click here to see larger image

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 codetype PIA

  1. Open your managed code solution (.sln) file in Microsoft Visual Studio .NET or Microsoft Visual Studio .NET 2003.
  2. In the Solution Explorer window, expand the References node.
  3. Right-click References, and click Add References to open the Add reference dialog box, shown in Figure 6.
  4. Click the COM tab.

    Click here to see larger image

    Figure 6. Add Reference dialog box with the COM tab selected (click picture to see larger image)

  5. 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.
  6. Highlight the component and click Select. You will see it listed in the Selected Components list box at the bottom of the tab.
  7. Click OK. You should see Microsoft.Office.Core added to the References node in the Solution Explorer, as shown in Figure 7.

    Aa159923.officeprimaryinteropassembliesfaq_fig7(en-us,office.11).gif

    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: 11.0.0.0. On a Microsoft Windows XP operating system, it looks something like the following:

C:\WINDOWS\assembly\GAC\office\11.0.0.0__71e9bce111e9429c\office.dll

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:

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 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\11.0.0.0__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\
        11.0.0.0__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\
        11.0.0.0__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\
        11.0.0.0__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.

Additional Resources

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:

Show:
© 2014 Microsoft