为什么 Office PIA 无法正确安装到 GAC?

发布于 2024-10-18 14:02:13 字数 1511 浏览 5 评论 0 原文

我目前正在从事 ac# 项目,需要访问 Outlook。开发是在两台不同的机器上完成的,其中一台安装了 Office,另一台没有安装。我之前询问如何针对 Outlook com 编译我的项目对象,其中一条评论建议我针对办公室主要互操作程序集(PIA)进行编译。在我下载的 Office 中2007 PIA,有一个 msi 文件,应该为 Office 的不同部分安装许多 PIA。我的问题是这似乎不会发生。在我的无办公室计算机上,在

msiexec /i o2007pia.msi

提示符下键入后,Windows 安装程序启动,并显示一个消息框,显示“Windows 配置 Microsoft Office 2007 主互操作程序集时请稍候。正在收集所需信息”以及进度条约为 33% ,之后它就消失了,之后

gacutil -l microsoft.office.interop.outlook

对于 Office 2007 没有产生任何结果(我确实得到了一个结果,其版本为 10.0.4504.0,并且是早期安装尝试使用错误 Office 版本的结果。但是 Office 2007 PIA 有主要版本 12。)

我看到了一些可能的解释,但我并不真正相信其中的一个:

  • GAC 无法处理同一程序集的多个版本,因此不允许我安装较新的版本。

  • 不知何故,我没有满足要求。这些基本上是 XPsp2 和 .Net 1.1 或更高版本,我都有。要求部分还提到,该下载适用于我没有安装的 Office 2007,但我不认为这是一个要求。这既是因为未将其指定为要求,也是因为 Hans Passant 在对 我最初的问题非常确定 PIA 可以专门用于在未安装 Office 的情况下进行开发,因此将 Office 作为先决条件是没有意义的。

那么,有谁知道为什么 Office 2007 PIA 无法正确安装,或者我可以采取哪些措施来更接近答案?如果您需要更多信息,请告诉我。谢谢。

I am currently working on a c# project, where I need to access Outlook. The development is being done on two different machines, one of which has office installed, and one of which doesn't. I previously asked how to compile my project against the outlook com object, and one of the comments suggested that I compiled against the office primary interop assembly, or PIA. In my downloaded Office 2007 PIA, there is an msi file, that is supposed to install a number of PIAs for the different parts of Office. My problem is that this seemingly doesn't happen. On my office-less machine, after typing

msiexec /i o2007pia.msi

at a prompt, the windows installer starts up, with a message box showing "Please wait while Windows configures Microsoft Office 2007 Primary Interop Assemblies. Gathering required information" along with a progress bar at about 33%, after which it disappears, and after which

gacutil -l microsoft.office.interop.outlook

yields no results for Office 2007 (I do get a result, which is versioned 10.0.4504.0 and is the result of an earlier installation attempt with a wrong Office version., but Office 2007 PIAs have major version 12.)

I see a couple of possible explanations, none of which I really believe in:

  • GAC can't handle multiple versions of the same assembly, and so won't allow me to install a newer version.

  • Somehow I don't fulfil the requirements. These are basically XPsp2, and .Net 1.1 or above, both of which I have. The requirements section also mentions, that the download works with office 2007, which I don't have installed, but I don't think this is a requirement. This is both because is isn't specified as a requirement, but also because Hans Passant in a comment to my original question was very sure that the PIAs could specifically be used for developing without Office being installed, so it would not make sense to have Office as a prerequisite.

So does anyone have any idea why the Office 2007 PIAs do not install correctly, or what I could do to get closer to an answer? If you need more information, please let me know. Thanks.

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

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

发布评论

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

评论(2

深海蓝天 2024-10-25 14:02:13

我不久前在一个类似的项目中遇到了这个问题。如果计算机上已安装 Office,则 PIA 可再发行组件只会安装 PIA(这很有意义,但在部署时可能会很烦人)

Visual Studio 应该将 Office PIA 安装到其自己的安装目录下的文件夹中 - 例如例如,在我的计算机上,我有以下所有 PIA 的副本:

C:\Program Files (x86)\Microsoft Visual Studio 10.0\Visual Studio Tools for Office\PIA\Office14

如果安装 VS 时计算机上有 Office,或者 VS 安装程序中可能有一个用于安装 VSTO 的安装选项,则可能仅安装这些 PIA (Office 的 Visual Studio 工具)。

如果您的问题只是与在没有 Office 的开发计算机上运行构建相关,那么您可以尝试重新运行 VS 安装程序,看看是否有安装 VSTO 的选项,或者尝试使用 google 搜索并查看如果有单独的 VSTO 下载,

否则,我只需将 PIA 从此文件夹复制到其他开发盒上的类似位置。

I hit this a while ago, with a similar project. The PIA redistributable will only install the PIAs if Office is already installed on the machine (which kind of makes sense, but can be annoying when it comes to deployment)

Visual Studio should install the Office PIAs into a folder under it's own install directory - for example, on my machine I have a copy of all the PIAs under:

C:\Program Files (x86)\Microsoft Visual Studio 10.0\Visual Studio Tools for Office\PIA\Office14

It's possible that these only get installed if you have Office on your machine at the time VS is installed, or perhaps there is an install option in the VS installer to install VSTO (Visual Studio Tools for Office).

If your problem is just related to getting a build working on the development machine that doesn't have Office, then you could try re-running the VS installer and see if you get an option to install VSTO, or try a google search and see if there is a separate VSTO download

Otherwise, I would just copy the PIAs from this folder to a similar location on the other Dev box.

你怎么敢 2024-10-25 14:02:13

对于第一点,我 100% 确定 GAC 已实现支持相同程序集的版本控制,您可以构建一个名为 myCode.dll 的程序集并将其版本 1.0 注册到 GAC,然后构建版本 1.1 和 2.0 并将两者都添加到 GAC 中,即使它们都具有相同的文件名,GAC 也会保留两者,并且每个应用程序都将能够根据可用的程序集绑定信息使用正确的版本,基本上每个应用程序都保存对该版本的引用除非指定,否则 1.0 仍然会获取它,并且不受新版本存在的影响。

最终,当您在 GAC 中列出 Outlook PIA 时,您只能看到最新的可用版本,而不是全部版本,但您肯定应该能够以某种方式在 GAC 中推送另一个版本。

for the first point, I am 100% sure that GAC has been implemented to support versioning of the same assemblies, you can build an assembly called myCode.dll and register its version 1.0 to the GAC, then you build the version 1.1 and 2.0 and add both to the GAC, even if all of them have the same file name, GAC will keep both and every application will be able to use the proper version depending on the assembly binding information available, basically every application which holds a reference to the version 1.0 still gets it unless specified and is not affected by the presence of newer version.

Eventually when you list the presence of the Outlook PIA in the gac you see only the latest available version and not all of them but surely you should be able, somehow, to push another version in the GAC anyway.

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