[英]Multiple versions of Office Primary Interop Assemblies in .NET project
I'm using Office Primary Interop Assemblies to control PowerPoint from my WPF app. 我正在使用Office Primary Interop程序集从WPF应用程序控制PowerPoint。 Currently I'm using PIA v14 in my project and it works with both Office 2010 and Office 2013 without problems.
当前,我在项目中使用的是PIA v14,它可以与Office 2010和Office 2013一起正常使用。 But I need to add support also for Office 2007 (when I tested my app on computer with Office 2007, it didn't work).
但是我还需要增加对Office 2007的支持(当我在装有Office 2007的计算机上测试我的应用程序时,它不起作用)。
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? 因此,我的问题是:我应该将项目中引用的PIA更改为v12(以支持Office 2007/2010/2013),还是可以将v12和v14(也许还有v15)PIA添加到项目中并动态加载正确应用程序启动过程中的程序集版本是否基于目标计算机上安装的Office版本? Also, is there some compatibility risks, if I will use PIA v12 on all Office versions (2007/2010/2013)?
此外,如果我将在所有Office版本(2007/2010/2013)上使用PIA v12,是否存在兼容性风险?
There is a simple solution for this, Use one of the Office Interop wrapper assemblies. 为此,有一个简单的解决方案,即使用Office Interop包装程序组件之一。 These wrapper amssemblies use late binding to support the feature of specific version of Office.
这些包装程序组合使用后期绑定来支持Office特定版本的功能。 I have used NetOffice and I would recommend you to use this.
我曾经使用过NetOffice ,建议您使用它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.