与 Office 2003 和 2007 的互操作

发布于 2024-07-17 04:36:22 字数 746 浏览 5 评论 0原文

我希望我的应用程序能够在两个版本的 Office(以及其中的 Outlook)中运行。 我知道我无法并行安装它们完整(Outlook 确实是一场战斗)。

具体来说,我们的应用程序会打开 Outlook,填写一些信息并加载联系人(以便他们可以选择将其发送给谁)以及其他一些基础知识。 如果重要的话,操作系统可能会有所不同,包括 Windows SP、Server 2003、Server 2008 和 Vista。

我们正在考虑使用 Office 2007(无论我们喜欢与否,迟早都会使用,所以我准备越早越好),如果我安装 Office 2007,我发现我可以不要使用旧的互操作 dll(应用程序无法编译)。 我只能假设,如果我使用 2007 年的互操作,那么 2003 年就不起作用了——这就是我们现在所做的。

其他应用程序也这样做,但我的 Google foo 失败了,我的 StackOverflow foo 也差不多。

关于如何让 Visual Studio 允许我为两者编写代码有什么想法吗?

编辑: 我实际上忘记了这个问题,但我有答案。

答案是其他原因。 Interop 工作得很好,但是另一段代码引用了另一个版本特定的引用(具体来说是 Excel)而不是 Interop。 由于之前从未使用过 Interop,我只是认为这并不重要,而且它们是一回事。 事实证明我错了。 一旦我们删除了所有引用并重新添加回正常的 Microsoft.Office.Interop 引用,一切就都正常了 (TM)。

I would like to have my application function with both version of Office (as well as Outlook within those). I understand I can't install them full in parallel (Outlook being the fight really).

In specific, our application opens up Outlook, fills some information and loads up the contacts (so they can select who to send it to), and some other basics. If it matters, the OS varies from Windows SP, Server 2003, Server 2008, and Vista.

We're considering going to Office 2007 (going to have to sooner or later whether we like it or not, so I'm preparing sooner rather than later) and if I install Office 2007 I find I can't use the older interop dll (app won't compile). I'm left to assume that if I use the 2007 interop that 2003 won't work -- which is what we're on now.

Other apps do this but my Google foo fails me and my StackOverflow foo is about the same.

Any thoughts on how to get Visual Studio to allow me to code for both?

edit:
I actually forgot about this question however I have the answer.

The answer was the cause from something else. The Interop worked just fine however another bit of code referenced another version specific reference (of Excel, to be specific) instead of Interop. Having never worked with Interop before, I just assumed it didn't matter and they were one and the same. Turns out I was wrong. Once we removed all the referenced and re-added back normal Microsoft.Office.Interop references, it all Just Worked (TM).

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

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

发布评论

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

评论(2

绝情姑娘 2024-07-24 04:36:22

呃,所以问题可以结束了,我将在这里添加答案:

答案是其他原因造成的。 Interop 工作得很好,但是另一段代码引用了另一个版本特定的引用(具体来说是 Excel)而不是 Interop。 由于之前从未使用过 Interop,我只是认为这并不重要,而且它们是一回事。 事实证明我错了。 一旦我们删除了所有引用并重新添加回正常的 Microsoft.Office.Interop 引用,一切就都正常了 (TM)。

Err, so the question can close I'll add the answer here:

The answer was the cause from something else. The Interop worked just fine however another bit of code referenced another version specific reference (of Excel, to be specific) instead of Interop. Having never worked with Interop before, I just assumed it didn't matter and they were one and the same. Turns out I was wrong. Once we removed all the referenced and re-added back normal Microsoft.Office.Interop references, it all Just Worked (TM).

帅气尐潴 2024-07-24 04:36:22

该应用程序无法编译? 你在说什么? 错误是什么?
如果您安装了 Office 桌面套件,它应该不会影响代码的编译。

您并不是说该应用程序无法运行。 你是说编译中断了。 这怎么可能?

可能是您没有安装 PIA,或者旧的 PIA 被卸载,或者当您安装新 Office 时,您获得了新的 PIA 并且存在一些不兼容性。

后一种选择对我来说似乎难以置信。

我想这是别的东西。 但看看这个问题已经休眠了多久,我想你现在已经离开了。

The app won't compile? What are you talking about? What is the error?
If you install the Office desktop suite, it should not affect the compilation of your code.

You're not saying that the app doesn't function. You're saying the compile breaks. How is that possible?

It could be that you've not installed the PIAs, or the older PIAs got uninstalled, or when you installed the new office you got new PIAs and there is some incompatibility.

The latter option there seems implausible to me.

I am thinking it is something else. But seeing how long this Q has been dormant, I suppose you have moved on by now.

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