Skip navigation.

1.x To 2.0 Migration Tip: Where Did WebForm_ DoPostBackWithOptions Go?All recent posts1.x To 2.0 Migration Tip: Where did ConfigurationManager Go?

1.x To 2.0 Migration Tip: Office Web Components Cause Compilation Error

This one goes to Microsoft Office Web Components (OWC) aficionados.

Ever since I published my article about OWC, I’ve received a ton of feedback. I’m still surprised how well it was received.

While migrating a project from 1.x to 2.0, I hit a snag. The compiler began to complain it could not compile a callable wrapper for the OWC library because it had no strong signature.

We strongly-sign and carefully version our assemblies. It’s a great exercise in discipline, although some folks might prefer ad hoc swapping of DLLs of various versions. I’m not sure why the 2.0 compiler took up an issue with a reference to the OWC wrapper from a strongly-signer assembly.

The correct way to interop with COM objects is via Primary Interop Assemblies (PIA). A vendor of COM object(s) needs to provide PIAs for other developers to consume. I was breaking my rule by ignoring MS Office PIAs and referencing the OWC object library directly.

The 2.0 compiler forced me to go out and find Office XP and Office 2003 PIAs. These installations behave differently, so pick one and stick with it:

  • The Office XP one simply unpacks everything into a designated folder. In Visual Studio go to Project | Add Reference…, switch to the Browse tab, navigate to the folder where you unpacked PIAs and select Microsoft.Office.Interop.Owc11.dll.
  • The Office 2003 download installs everything quietly. Assemblies seem to end up in GAC (C:\WINDOWS\assembly). Visual Studio doesn’t display GAC assemblies in the Add Reference dialog box (duh!), so you need to follow directions of KB article Q306149.

Once you jump through these hoops, you should be able to compile just fine.

Comments

No comments yet

Emails and Notifications

Would you like to be notified when somebody responds to this post? 

TrackBacks

Sorry, TrackBacks are not allowed.

Submit your comment

Please enter only text since all HTML tags except hyperlinks will be stripped. Hyperlinks will become live links. Any comments with flaming or offensive language will be deleted. Be courteous to other posters. Thank you.

Your name (required):
Your email (optional):
Your site's URL (optional):
Enter this number
Type in the number above:
Comment (required):