VS 2012未列出Microsoft.Office.Interop程序集,但可以在GAC中找到它 [英] VS 2012 does not list Microsoft.Office.Interop assembly while it can be found in GAC

查看:44
本文介绍了VS 2012未列出Microsoft.Office.Interop程序集,但可以在GAC中找到它的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在当前项目中添加对 Microsoft.Office.Interop 的引用,但我只能选择

I want to add a reference to Microsoft.Office.Interop to a current project but I can only select

但是我可以在GAC中找到它们

but I am able to find them in the GAC

现在,我选择通过导航到GAC中的路径来添加它们

For now I choose to add them by navigating to the path within the GAC

但是我仍然有一个问题,为什么在尝试添加参考时,为什么我在GAC中安装了它们(安装了Office 2013)却在Visual Studio 2012中找不到它们?

推荐答案

您认为VS对话框列出了GAC中的程序集的假设是错误的.它列出了参考程序集,从不应将它们存储在GAC中.GAC仅包含运行时程序集,当有安全性或错误修复更新时,它们可以随时更改.参考程序集必须稳定,以便以后重建项目时可以复制完全相同的构建.

Your assumption that the VS dialog lists assemblies in the GAC is wrong. It lists reference assemblies, they never should be stored in the GAC. The GAC only contains runtime assemblies, they can change anytime when there is a security or bug fix update. Reference assemblies must be stable so you can reproduce the exact same build when you rebuild a project later.

PIA已过时,不应再使用.您在旧的CLR v2 GAC中的c:\ windows \ assembly中找到了这些文件.它们仅适用于使用旧VS版本,VS2008及更低版本构建的项目.CLR v4 GAC存储在c:\ windows \ microsoft.net \ assembly中.您将不会在其中找到任何Office互操作程序集.

PIAs are obsolete and should not be used anymore. The ones you found are in the old CLR v2 GAC in c:\windows\assembly. They are only meant for projects built with old VS versions, VS2008 and before. The CLR v4 GAC is stored in c:\windows\microsoft.net\assembly. You won't find any Office interop assemblies stored there.

Microsoft不像以前的Office版本那样为Office 2013提供PIA下载.它们已被.NET 4.0/VS2010嵌入互操作类型"功能彻底而优雅地替换.又称为无PIA"功能.您必须改为从"COM"选项卡添加引用.类似于"Microsoft Word 15.0对象库"以与Word 2013的版本互操作.无需附带程序,也无需在用户的计算机上安装PIA,Word互操作类型将在构建时嵌入到您的程序中.

Microsoft does not provide a PIA download for Office 2013 like it did for older Office versions. They have been thoroughly and elegantly replaced by the .NET 4.0/VS2010 "Embed Interop Types" feature. Aka the "No PIA" feature. You must add the reference from the COM tab instead. Like "Microsoft Word 15.0 Object Library" to interop with the 2013 version of Word. Nothing you have to ship along with your program and no need to install PIAs on the user's machine, the Word interop types are embedded into your program when it was built.

这篇关于VS 2012未列出Microsoft.Office.Interop程序集,但可以在GAC中找到它的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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