Cannot add a reference to the primary interop assembly (PIA) for the Office application

To be able to program against an unmanaged application using managed code, you must have an interop assembly. The Visual Studio Tools for Office Project Wizard checks that the required assembly is in the global assembly cache (GAC) before it creates a document-level project for Microsoft Office Word or Microsoft Office Excel.

You must have the correct primary interop assemblies (PIAs) installed in the GAC, and a reference to the PIAs in your project.

To correct this error

  1. Install the PIAs. For more information, see How to: Install Office Primary Interop Assemblies.

  2. Add a reference to each required PIA to your project. For more information, see How to: Target Office Applications Through Primary Interop Assemblies.

See Also

Reference

Office Primary Interop Assemblies