To use the features of a Microsoft Office application from an Office project, you must use the primary interop assembly (PIA) for the application. The PIA enables managed code to interact with a Microsoft Office application's COM-based object model.
The PIAs are automatically added to a location in the file system, outside of the global assembly cache, while you install Visual Studio. When you create a new project, Visual Studio automatically adds references to these copies of the PIAs to your project. Visual Studio uses these copies of the PIAs, instead of the assemblies in the global assembly cache, to resolve type references when you develop and build your project.
How To Install Microsoft Office Interop Outlook Assembly
To perform certain development tasks, the PIAs must be installed and registered in the global assembly cache on the development computer. Typically, the PIAs are installed automatically when you install Office on the development computer. For more information, see Configure a computer to develop Office solutions.
In most cases, you should add references to the PIAs that are installed by Visual Studio under the %ProgramFiles(x86)%\Microsoft Visual Studio\Shared\Visual Studio Tools for Office\PIA\ directory. These versions of the assemblies appear on the Framework tab of the Reference Manager dialog box. For more information, see How to: Target Office applications through primary interop assemblies.
If you've installed and registered the PIAs in the global assembly cache, these versions of the assemblies appear on the COM tab of the Reference Manager dialog box. Avoid adding references to these versions of the assemblies, because there are some development issues that can occur when you use them. For example, if you've registered different versions of the PIAs in the global assembly cache, your project will automatically bind to the version of the assembly that was registered last, even if you specify a different version of the assembly on the COM tab of the Reference Manager dialog box.
When you install and register the Office PIAs in the global assembly cache (either with Office or by installing the redistributable package for the PIAs), the binding redirect assemblies are also installed only in the global assembly cache. These assemblies ensure that the correct version of the primary interop assemblies is loaded at run time.
For example, when a solution that references a Office 2010 assembly runs on a computer that has the Office 2013 version of the same primary interop assembly, the binding redirect assembly instructs the .NET Framework runtime to load the Office 2013 version of the primary interop assembly.
This an assembly you can use for Outlook 2013/2016/2019 COM interop, generated and signed by Microsoft. This is entirely unsupported and there is no license since it is a repackaging of Office assemblies.
The feature is very desirable, it avoids your customer having to install the PIAs on his machine and for you to include them with your installer. Solving the issue when neither takes care of it, an entirely too common mishap. In addition, the PIAs for Office are very large, the great advantage of embedding the interop types is that your assembly only contain the types that you actually use. Many megabytes reduced to a few kilobytes.
To load the Microsoft.Office.Interop.Outlook interop assembly, we need to use the static LoadWithPartialName method from the Reflection.Assembly .NET Framework class. Static methods are methods that are always available and are called in Windows PowerShell by using double colons instead of the normal period. When loading the Microsoft.Office.Interop.Outlook assembly, it produces feedback that tells you the assembly has been loaded. This is seen here:
we have developed an Outlook Addin with VSTO 2010 and .NET 4.5. The Addin is basically developed with Office 2007 and PIA 2007 (12.0.0.0) are referenced but not embedded. When we install the addin on computers with a different outlook version e.g. 2013 or 2016 vsto automatically uses the respective versions of the interop dlls.
On one installation at a client with office 2016 he keeps still demanding the interop version 12.0.0.0 even if all the interop 15.0.0.0 are correctly installed into the GAC. I had this problem once but there the user in fact had an old Office 2007 programm installed but this time not. But it is not a fresh Office 2016 installation but the client upgraded from 2007 to 2013 and the to 2016. 2ff7e9595c
Comentarios