gpt4 book ai didi

.net - Office 插件的前向兼容性

转载 作者:行者123 更新时间:2023-12-03 03:10:42 25 4
gpt4 key购买 nike

我已经使用 VS 2010 为 Office 2010 构建了一个加载项。我已关注 these steps创建 msi,但是当我尝试使用 Office 2013 安装它时,我收到一条错误消息:

"A required component for interacting with excel is not available..."

我是否需要链接到 Office 2013 程序集才能为 Office 2013 进行部署?

编辑:上面写着here使用 VSTO V4 应该可以兼容,但仍然不起作用。

最佳答案

按照上述教程,您自己创建了一个会产生上述错误的 Windows Installer 启动器条件。您应该删除通过组件 ID 检查特定 PIA 组件的条件。

Condiotions to remove

不要检查和产生错误错误,而是添加 VSTO 和 PIA 作为先决条件,您也可以将其包含在您的设置中:

enter image description here

您必须download Microsoft Office 2010 Primary Interop Assemblies Bootstrapper Package并将其安装在您的开发机器上。这使您能够将 PIA 2010 添加为安装项目中的先决条件,这正是您所需要的。

此外,如果您需要在安装中包含 PIA 2010,则必须复制 Microsoft Office 2010: Primary Interop Assemblies Redistributable (所有提取的文件)到C:\Program Files\Microsoft SDKs\Windows\v7.0A\Bootstrapper\Packages\Office2010PIARedist

您的设置将如下所示:

enter image description here

不,您不需要链接 2013 PIA 即可使您的解决方案在 Office 2013 中运行,VSTO 和 PIA 2010 应该与 Excel 2013 一起使用 - 但 Excel 2013 应用程序的额外功能自然会丢失。但如果您想使用 VSTO 2012,则需要升级到 VS 2012 或 2013 .

因此您可以继续使用 VSTO 2010 for Office 2013。

But also look at this article.

When you compile an add-in project that targets the .NET Framework 4, by default the type information for all the PIA types referenced in the add-in code is embedded in the add-in assembly. At run time, this type information is used to resolve calls to the underlying COM type, rather than relying on type information in the PIAs.

毕竟,这意味着如果您以 .NET 4 为目标,则根本不必担心目标计算机上的 PIA。因此,您也不需要添加 Microsoft Office 2010 PIA 作为先决条件。但您仍然需要 VSTO 运行时先决条件。

只需检查您引用的 Microsoft.Office.Interop.Excel 版本是否正确,并且 EmbedInteropTypes 设置为 true:

enter image description here

这是删除这些搜索 Office 2010 共享 PIA 条件的充分理由。

<小时/>

备注:当我输入 another component ID form here 时,有问题的 Windows Installer Launcher 条件似乎起作用了。 ,即{FAB10E66-B22C-4274-8647-7CA1BA5EF30F}。它是 Office 2007 组件 ID。我已经使用 Office 2007 和 Office 2013 对其进行了测试,两种设置均顺利进行,没有任何错误,并且加载项正在运行。

关于.net - Office 插件的前向兼容性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20212890/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com