VSTO 加载项无法在 Windows XP 的 Word 2010 中加载

发布于 2024-10-11 20:40:10 字数 708 浏览 1 评论 0原文

我有一个 Word 的 VSTO 插件。

使用 Visual Studio 2010(适用于 Word 2007 和 2010)以及 VS 2008(适用于 Word 2003)进行开发。

它可以在 Windows(XP、Vista 和 Windows 7)以及 Office 版本(即 Office 2003、2007、2010)的许多不同组合中安装和运行。

除外:Windows XP (SP3) 上的 Word 2010。

症状是,当 Words 启动时,它似乎会加载加载项一段时间,但最终却没有加载,并且加载项出现在“非活动应用程序加载项”列表中。

加载项启动时有一些代码可以捕获异常并报告异常,但该代码永远不会被执行。因此,在加载项开始执行之前,似乎某个地方出现了异常。

这听起来像是未找到程序集,这让我认为 Office 2010 PIA 可能未安装,但我尝试显式安装它,它说它已经存在(这应该是这种情况,因为 Office 2010 应该安装它(与未安装它的以前的 Office 版本不同)。

这也可能是代码不被信任之类的症状,但我继续使用 caspol.exe 的代码信任机制,这对于 Office 和 Windows 的所有其他混合体似乎都可以,所以我猜它也可以O 2010 和 W XP。

如果缺少一个“我的”程序集,那么当该加载项安装在其他 Windows 版本上时,该程序集也会丢失,因为无论操作系统如何,安装都是相同的。

我很受阻。

I have a VSTO addin for Word.

Developed with Visual Studio 2010 (for Word 2007 and 2010) and also VS 2008 (for Word 2003).

It installs and runs in many different combinations of Windows (XP, Vista and Windows 7) as well as Office versions (i.e. Office 2003, 2007, 2010).

Except for one: Word 2010 on Windows XP (SP3).

The symptoms are that when Words starts up it appears to load the add-in for a while but in the end doesn't and the add-in appears in the Inactive Application Add-ins list.

There is code in the startup of the add-in that catches exceptions and reports on them, but that code never gets executed. So it seems that there is an exception somewhere before the add-in even starts executing.

That sounds something like an assembly not being found which makes me think maybe the Office 2010 PIA is not installed, but I tried installing that explicitly and it says it's already there (which is what is supposed to be the case because Office 2010 is supposed to install it (unlike previous Office versions which didn't install it)).

It would also be a symptom of something like the code not being trusted, but I have continued using the code trusting mechanism of caspol.exe, which seems OK with all the other mixtures of Office and Windows, so I'm guessing it's OK with O 2010 and W XP.

And if it was one "my" assemblies that was missing, then it would be missing when the add-in is installed on other Windows versions, because it's the same install regardless of OS.

I'm stymied.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

庆幸我还是我 2024-10-18 20:40:10

毕竟,答案相当简单:

似乎当您在 Vista 和 Windows 7 上安装 Office 2010 时,会自动安装 Office 2007 主互操作程序集。 Office 2007 PIA 是与 VSTO 和 Office 2010 一起使用的 PIA。

但是:当您在 Windows XP(32 位)(我还没有尝试过 XP x64)上安装 Office 2010 时,PIA 不会自动安装。然后,如果您尝试运行从 Microsoft 获取的 o2007.msi 安装程序,它会告诉您除非安装了 Office 2007,否则该安装程序将无法工作!不是很有帮助。

然而,在我偶然发现这个 StackOverflow 问题,我发现,当然,您所需要做的就是将所需的 PIA 的实际 DLL 安装到可执行文件运行的文件夹中,然后就可以了!

After all, the answer is fairly simple:

It seems that when you install Office 2010 on Vista and Windows 7, the Office 2007 Primary Interop Assemblies are installed automatically. And the Office 2007 PIAs are the ones that are used with VSTO and Office 2010.

But: when you install Office 2010 on Windows XP (32 bit) (I haven't tried XP x64), the PIAs are NOT installed automatically. Then, if you try to run the o2007.msi installer that you can get from Microsoft, it tells you that it won't work unless Office 2007 is installed! Not very helpful.

However, after I stumbled on this StackOverflow question, I discovered that, of course, all you need to do is install the actual DLLs for the PIAs that you want into the folder where your executable runs from, and there you are!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文