Monday, August 4, 2008

COM Shared Add-in (Part 4)

Referencing the Office XP PIAs

Unlike standard COM interop assemblies, you cannot browse to a PIA and set a reference to it as you would with other assemblies in the Microsoft Visual Studio .NET IDE. Instead, you set a reference to an existing COM type library; if a PIA exists in the GAC for that COM type library, the PIA will be silently referenced instead. To demonstrate this behavior, perform the following steps on a computer with Visual Studio .NET and the Microsoft Outlook 2002 PIA installed:
  1. In the Solution Explorer window, Right click References. Click the Add Reference and the Add Reference dialog box appears.
  2. Click the COM tab.
  3. Select the Microsoft Outlook 10.0 Object Library entry in the list of COM type libraries.
  4. Click Select to select the Outlook object library entry.
  5. Click OK to add the reference.
  6. In the Solution Explorer window, in the References folder, click the Outlook reference.
  7. In the Properties window, notice that the Path property is set to a string similar to C:\WINDOWS\assembly\GAC\Outlook\...\Microsoft.Office.Interop. Outlook.dll. This indicates that the Outlook PIA is being used instead of forcing Visual Studio .NET to create its own COM interop assembly in your project's location.

No comments: