There are many issues with Office PIA-s, the most painful one being the fact one has to use the lowest denominator PIA-s to be able to support all Office versions. We’ve also had issues with PIA-s and obfuscation when we tried to embed the interop assemblies.

I’ve found an idea on a Microsoft blog: generate your own wrappers for the Office COM objects. So it seems we have to write a tool that will do the following:

– scan all Office versions type libraries

– generate RCW-s for all Office objects

– consolidate common types

– generate wrappers for API-s not available in older Office versions that will gracefully degrade (one example is StartNewUndoEntry).

An even better option is to use the dynamic support available in .NET 4.0.

Still, some scanning is still needed, to detect situations where an exception would be thrown. Also, using dynamic loses Intellisense support and the development process must work around this issue.

Advertisements