Microsoft.Office.Core 参考缺失
使用 codeproject 中提供的示例,我正在努力找出在哪里可以找到对 Microsoft 库的引用.Office.核心。
我收到错误“找不到引用的组件‘Microsoft.Office.Core’。”
我这个系统上只安装了office 2007企业版和outlook 2003。难道是这个原因造成的吗?否则我应该引用哪个特定的 dll?
Using the example provided in codeproject I am struggling to work out where I can find the reference to the library Microsoft.Office.Core.
I am getting the error "The referenced component 'Microsoft.Office.Core' could not be found."
I only have office 2007 enterprise edition and outlook 2003 installed on this system. Could this be the cause of this? Otherwise which specific dll am I supposed to be referencing?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(15)
您可以通过添加
Microsoft Office 12.0 对象库
的引用,在添加引用窗口的 COM 组件 选项卡中添加Microsoft.Office.Core
的引用。屏幕截图将显示您需要什么组件。You can add reference of
Microsoft.Office.Core
from COM components tab in the add reference window by adding reference ofMicrosoft Office 12.0 Object Library
. The screen shot will shows what component you need.上面的答案都没有帮助我,我使用的是 Visual Studio 2017。我所做的是,使用 Visual Studio 安装程序安装了 Office/SharePoint 开发。
之后,我能够看到“office”,该程序集包含 Microsoft.Office.Core。
希望这对您有帮助。
None of the above answer helped me, i was using Visual Studio 2017. What I did is, installed Office/SharePoint Development using Visual Studio Installer.
After that, I was able to see 'office', this assembly contains Microsoft.Office.Core.
Hope this helps you.
您需要下载并安装适用于您正在使用的 Office 版本的 PIA(主互操作程序集)。安装后,您可以添加对项目的引用,并且可以从添加引用对话框中使用它们。以下是下载它们的链接...
Office 2010 PIA
Office 2007 PIA
Office 2003 PIA
You need to download and install the PIA (primary interop assemblies) for the version of Office you are using. Once installed you can then add a reference to your project and they will be available from the add reference dialog. Here are the links to download them...
Office 2010 PIA
Office 2007 PIA
Office 2003 PIA
安装 Office PIA(主互操作程序集)后,添加对您的项目的引用 ->它位于 .NET 选项卡上 - 组件名称“Office”
After installing the Office PIA (primary interop assemblies), add a reference to your project -> its on the .NET tab - component name "Office"
如果有人没有 .NET 参考。 COM(选项卡)或未在安装 Visual 的计算机上安装 Office 可以执行以下操作:
添加引用:
If someone not have reference in .NET . COM (tab) or not have office installed on machine where visual was installed can do :
Add references from:
现在有一个 nuget 包可以做到这一点。
https://www.nuget.org/packages/NetOffice.Core.Net40/
首先我在COM中没有找到office,所以尝试了这个nuget,它成功了!
Now there is a nuget package for that.
https://www.nuget.org/packages/NetOffice.Core.Net40/
First I didn't find office in COM, so tried this nuget and it worked!
您可以使用此 NuGet 包,其中除了 Office 程序集之外还包括互操作程序集。
https://www.nuget.org/packages/Bundle.Microsoft.Office。互操作/
You can use this NuGet package which includes the interop assemblies in addition to the office assembly.
https://www.nuget.org/packages/Bundle.Microsoft.Office.Interop/
您是否确实查看了参考文献并向“Microsoft.Office.Core”库添加了 .NET 参考文献?如果您下载了示例应用程序,答案是肯定的。如果是这种情况,请遵循文章中的建议:
那应该可以解决你的问题。如果没有,请告诉我们。
Have you actually gone to your references and added a .NET reference to the 'Microsoft.Office.Core' library? If you downloaded the example application, the answer would be yes. If that is the case, follow the advice in the article:
That should solve your problem. If not, let us know.
如果您使用的是 Visual Studio 2012,要使其工作并引用 Microsoft Office Core,您必须通过 Visual Studio 进行引用,方法是单击顶部菜单的“项目”、“添加引用”、“扩展”按钮并选中 Office现在是(14.0)。
In case you are using Visual Studio 2012, for this to work and in order to make reference to Microsoft Office Core, you have to make the reference through Visual Studio by clicking on the top menu's Project, Add Reference, Extensions button and checking office which is now (14.0).
如果您无法找到 Office 2013 的 PIA,请按照下列步骤操作:
就完成了。
If you are not able to find PIA for Office 2013 then follow these steps:
And you are done.
我也有同样的烦恼。我转到“添加引用”、“COM”选项卡,选择“Microsoft Office 15.0 对象库”。好的,我的问题结束了。
我的代码的一部分是:
I have the same trouble. I went to Add references, COM tab, an select Microsoft Office 15.0 Objetct Library. Ok, and my problem ends.
part of my code is:
当我尝试将旧的 C# 项目打开到 Visual Studio 2017 版本时,我遇到了同样的问题。当您尝试打开使用以前版本的 VS 创建的项目并使用最新版本打开它时,通常会出现此问题。
我所做的是,打开我的项目并从项目中删除引用,然后添加 Microsoft Outlook 12.0 对象库和 Microsoft Office 12.0 对象库Microsoft Outlook 12.0 对象库
I faced the same problem when i tried to open my old c# project into visual studio 2017 version. This problem arises typically when you try to open a project that you made with previous version of VS and open it with latest version.
what i did is,i opened my project and delete the reference from my project,then added Microsoft outlook 12.0 object library and Microsoft office 12.0 object libraryMicrosoft outlook 12.0 object library
就我而言,当我从 Reference->COM 添加“Microsoft Excel Object Library”和“Microsoft Office Object Library”时,引用错误就会消失。
In my case when I added "Microsoft Excel Object Library" and "Microsoft Office Object Library" from Reference->COM then the reference error goes away.
我遇到了同样的问题,但 COM 组件在另一台计算机上工作正常。突然在另一台电脑上就找不到了。我参考了工作计算机上COM组件的路径,如图:
路径:C:\Program Files\Microsoft Office\root\vfs\ProgramFilesCommonX86\Microsoft Shared\Office16\MSO.DLL
添加后,一切按预期工作。
I encountered the same issue, but the COM component is working fine on another computer. Suddenly, it couldn't be found on the other computer. I referred to the path of the COM component on the working computer, as shown in the picture:
path:C:\Program Files\Microsoft Office\root\vfs\ProgramFilesCommonX86\Microsoft Shared\Office16\MSO.DLL
After adding it, everything worked as expected.
就我而言,当我在 nuget 包中安装“MSOffice.Object.Library”时,引用错误消失了。
In my case when i installed "MSOffice.Object.Library" in nuget package, the reference error goes away.