Primary Interop Assemblies

Office applications such as Excel and Word are written in unmanaged code.
The primary interop assemblies are the corresponding runtime callable wrappers for the Microsoft Office applications.
The only way .NET code can interoperate with the unmanaged Office COM objects is via the Interop Assemblies.
The Microsoft Office Primary Interop assemblies are the interop assemblies that you need to reference and use.
When you are adding references to PIAs from within your project you should use the .NET tab.
It is possible to create your own wrappers for COM Object Models using tlbimp.exe.
An interop assembly is a managed .NET equivalent of a COM type library.
An Interop Assembly that is distributed by the owner of the original COM server is called a primary interop assembly (PIA).
Primary Interop Assemblies are always digitally signed by the publisher of the original unmanaged assembly.


This namespace needs to be referenced in your code

using Excel = Microsoft.Office.Interop.Excel; 

Embedded PIAs

Visual Studio 2010 (C# v4.0) provided the ability to Embed Interop Types

Visual Studio References

When you install Visual Studio, the PIAs are automatically installed into the Visual Studio folder on the C drive.
When you create a new project, references are automatically added to refer to the PIAs on the C drive.
Can be added as a COM Reference.

© 2021 Better Solutions Limited. All Rights Reserved. © 2021 Better Solutions Limited TopPrevNext