In previous versions of .NET, Primary Interop Assemblies (PIA) acted as the bridge between unmanaged COM components and managed code. Though PIA solved the problem of marshalling for almost all types, they came with their own problems. One of the biggest problem was that even if a small feature was used, the developer had to ship the complete PIA which is not a small payload by any means.
Also, a developer had to develop an assembly for each version of word or excel that the application targeted. This drastically increased the size and the complexity of the deployment package.
With .NET 4.0 this has changed. Developers no longer need to ship the whole PIA. .NET 4.0 gives the developer the flexibility of embedding only those features that are used by the application rather than shipping the whole assembly. This also means that the developer does not need to worry about the availability of the target applications like Word or Excel. Enabling embedded interop assemblies is very easy. You right click the interop reference and change the EmbedInteropTypes from false to True.
When you do that, the interop assemblies are no longer referred. You can confirm this by using the reflector. The snapshot will look like below. Note that the Excel and Word are now namespaces within the project instead of references.
No comments:
Post a Comment