c# – What does the Embed Interop Types checkbox in VS do?


Office builds have this checkbox: Embed Interop Types

What is she responsible for? With this checkbox, it is not possible to copy the assembly locally.

I noticed that if you turn it off, then some operations with office objects require an explicit type conversion.


Original answer on EnSO: https://stackoverflow.com/a/20515311/5796587

This option was introduced to remove the need to deploy very large interop assemblies (PIAs -> Primary Interop Assemblies).

Enabling this option allows you to inline managed code to communicate with unmanaged assemblies in your assembly, but instead of inlining all the code in an interop assembly, inlines only the elements that are actually used in your code.

Read more in Scott Hanselman's blog about this and other Visual Studio improvements here . Additional information here and here .

The translation is quite free, for practical use, use the original materials on the links in this or the original answer.

Scroll to Top