Skip to content

Embedded interop types C# 4.0type safety

Embed COM interop types at compile time instead of runtime.

When referencing COM types in your C# application previously it would look for the Primary Interop Assembly (PIA) at runtime.

This was problematic as they can often be missing and overwritten but was required so that two different assemblies would treat the object in the same way.

C# 4.0 added a new /L switch to the compiler that embeds these interop types at compile time so they do not need to be independently managed and also changed the runtime so that two structurally-identical interop that may be embedded in two different assemblies can still be considered the same type.

More information