Dominik Palo
Dominik Palo

Reputation: 3111

Multiple versions of Office Primary Interop Assemblies in .NET project

I'm using Office Primary Interop Assemblies to control PowerPoint from my WPF app. Currently I'm using PIA v14 in my project and it works with both Office 2010 and Office 2013 without problems. But I need to add support also for Office 2007 (when I tested my app on computer with Office 2007, it didn't work).

So, my question is: Should I change my referenced PIA in project to the v12 (to support Office 2007/2010/2013) or it is possible to add both v12 and v14 (maybe also v15) PIAs to the project and dynamically loads correct version of assemblies during app start based on Office version installed on target computer? Also, is there some compatibility risks, if I will use PIA v12 on all Office versions (2007/2010/2013)?

Upvotes: 1

Views: 1696

Answers (1)

Kurubaran
Kurubaran

Reputation: 8902

There is a simple solution for this, Use one of the Office Interop wrapper assemblies. These wrapper amssemblies use late binding to support the feature of specific version of Office. I have used NetOffice and I would recommend you to use this.

Features provided by NetOffice

  • Office integration without version limitations
  • All features of the Office versions 2000, 2002, 2003, 2007, 2010, 2013 are included
  • Syntactically and semantically identical to the Microsoft Interop Assemblies
  • No training if you already know the Office object model, use your existing PIA code
  • Usable with .NET version 2.0 or higher
  • No dependencies, no interop assemblies, no need for VSTO

Upvotes: 5

Related Questions