我是否可以针对2007年至2016年所有Office版本运行的.net Framework 4.6.1创建VSTO Outlook外接程序? [英] Can I create a VSTO outlook addin targeting .net framework 4.6.1, which runs on all office versions from 2007 to 2016?

查看:481
本文介绍了我是否可以针对2007年至2016年所有Office版本运行的.net Framework 4.6.1创建VSTO Outlook外接程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个用VS 2008和3.5框架开发的Outlook插件,现在我想将其升级到最新的框架(4.6.1),但是当我尝试在VS 2012中创建一个针对4.6.1框架的Office项目时它只向我展示了Office 2010模板。因此,不可能开发针对4.6.1框架的VSTO 2007插件吗?我想坚持使用VSTO 2007,因为它保证可以在Office 2016之前的所有Office版本上运行,就像我目前针对.net 3.5的插件一样,如果我开发Office 2010插件,它可能会在Office 2007上崩溃。所以,请让我知道一种开发Office插件的方法,该插件受所有Office版本和目标的支持.net Framework 4.6.1。

I have an outlook addin developed with VS 2008 and for 3.5 framework.Now, I want to upgrade it to latest framework(4.6.1).But when I tried to create an office project in VS 2012 targeting 4.6.1 framework.It only showed me office 2010 template.So, is it not possible to develop a VSTO 2007 addin which targets 4.6.1 framework?I want to stick with VSTO 2007 because it is guaranteed to run on all office versions up to office 2016, as my current addin which targets .net 3.5 does.Whereas if I develop an office 2010 addin, it might crash on office 2007.So, please let me know a way to develop an office addin, which is supported by all office versions and targets .net framework 4.6.1.

推荐答案

您想针对.NET Framework 4.6.1开发插件,但仍以Office 2007为目标因为Office被认为始终是向下兼容的。尽管从理论上讲是这样,但实际上您会遇到问题(例如,随着时间的推移,Excel将其应用程序模型从MDI更改为SDI,从而导致针对较旧版本的插件中的各种可见性问题。

You want to develop your addin against .NET Framework 4.6.1 but still target Office 2007 as Office is considered to be always 'downward compatible'. Although it theoretically is the case, in real practice you will run into issues (for instance Excel changed its application model from MDI to SDI over time, resulting in all sorts of visibility issues in addins targeting the older versions).

.NET Framework也是如此。面向较低框架的应用程序应与更高版本的框架一起使用。另一种方法会导致实际问题。

The same goes for the .NET Framework. Applications targeting a lower framework should work with later frameworks. The other way around can cause real issues.

所以我认为最好的答案是使用Office PIA和.NET框架中最低的分母来支持较旧的Office版本。从理论上讲,这意味着您应该使用Office 2007 PIA和.NET 3.5,以获得与2007年及以后的所有Office版本的最佳兼容性。但是,在这种情况下,仍然存在不匹配的风险,如我在第一段中所述。

So the best answer in my opinion is to use the lowest denominator in both Office PIA and .NET framework to support the older Office versions. In theory that means you should stay with Office 2007 PIA's and .NET 3.5 for the best compatibility for all Office versions from 2007 and up. In this case there is however still the risk of mismatches as I explained in the first paragraph.

但是,一般来说,如果您只处理接口,则可以混合使用多种版本

In general you can however mix and match many versions if you only address the Interfaces available in the oldest Office versions, use late binding in special cases.

Microsoft的官方回答一直是与VSTO项目有关的,即只有两个Office版本每个VSTO版本都受支持,并且(再次)与前面已经提到的内容有关。有关此的更多信息,请参见: https:/ /msdn.microsoft.com/zh-CN/library/bb772080(v=vs.120).aspx

The 'official' answer from Microsoft has always been, related to VSTO projects, that only two Office versions are supported with each VSTO version, and that has (again) to do with what already was mentioned before. More information on this can be found here: https://msdn.microsoft.com/en-us/library/bb772080(v=vs.120).aspx

这篇关于我是否可以针对2007年至2016年所有Office版本运行的.net Framework 4.6.1创建VSTO Outlook外接程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆