Microsoft.Office.Core 参考缺失

发布于 2024-11-05 17:05:49 字数 263 浏览 4 评论 0原文

使用 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 技术交流群。

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

发布评论

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

评论(15

两个我 2024-11-12 17:05:49

您可以通过添加 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 of Microsoft Office 12.0 Object Library. The screen shot will shows what component you need.

enter image description here

海之角 2024-11-12 17:05:49

上面的答案都没有帮助我,我使用的是 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.

enter image description here

After that, I was able to see 'office', this assembly contains Microsoft.Office.Core.

enter image description here

Hope this helps you.

贱贱哒 2024-11-12 17:05:49

您需要下载并安装适用于您正在使用的 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

踏雪无痕 2024-11-12 17:05:49

安装 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"

掐死时间 2024-11-12 17:05:49

如果有人没有 .NET 参考。 COM(选项卡)或未在安装 Visual 的计算机上安装 Office 可以执行以下操作:

  1. 下载并安装:Microsoft Office 开发人员工具
  2. 添加引用:

    C:\Program Files (x86)\Microsoft Visual Studio 11.0\Visual Studio Tools for Office\PIA\Office15
    

If someone not have reference in .NET . COM (tab) or not have office installed on machine where visual was installed can do :

  1. Download and install: Microsoft Office Developer Tools
  2. Add references from:

    C:\Program Files (x86)\Microsoft Visual Studio 11.0\Visual Studio Tools for Office\PIA\Office15
    
魂归处 2024-11-12 17:05:49

现在有一个 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!

牛↙奶布丁 2024-11-12 17:05:49

您可以使用此 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/

梦一生花开无言 2024-11-12 17:05:49

您是否确实查看了参考文献并向“Microsoft.Office.Core”库添加了 .NET 参考文献?如果您下载了示例应用程序,答案是肯定的。如果是这种情况,请遵循文章中的建议:

如果您的系统没有 Microsoft Office Outlook 2003,您可能必须更改“OutlookConnector”项目使用的引用。也就是说,如果您收到描述为“无法找到名称空间名称‘Outlook’的类型”的构建错误,则您可能没有 Office 2003。只需展开项目引用,删除受影响的项目,然后添加适合您系统的 COM 库。如果有人有一种动态的方式来处理这个问题,我很想知道你已经做到了。

那应该可以解决你的问题。如果没有,请告诉我们。

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:

If your system does not have Microsoft Office Outlook 2003 you may have to change the References used by the "OutlookConnector" project. That is to say, if you received a build error described as "The type of namespace name 'Outlook' could not be found", you probably don't have Office 2003. Simply expand the project references, remove the afflicted items, and add the COM Library appropriate for your system. If someone has a dynamic way to handle this, I'd be curious to see you've done.

That should solve your problem. If not, let us know.

萝莉病 2024-11-12 17:05:49

如果您使用的是 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).

君勿笑 2024-11-12 17:05:49

如果您无法找到 Office 2013 的 PIA,请按照下列步骤操作:

  1. 单击 Visual Studio 中的“解决方案资源管理器”
  2. 右键点击您的项目名称(不是解决方案名称)
  3. 选择“管理 Nuget 包”
  4. 点击“浏览”并搜索 PIA 2013,选择显示的 PIA 并点击“安装”......

就完成了。

If you are not able to find PIA for Office 2013 then follow these steps:

  1. Click on Solution Explorer in Visual Studio
  2. Right click on your project name (not solution name)
  3. Select 'Manage Nuget packages'
  4. Click on Browse and search for PIA 2013, choose the shown PIA and click on Install.....

And you are done.

无所谓啦 2024-11-12 17:05:49

我也有同样的烦恼。我转到“添加引用”、“COM”选项卡,选择“Microsoft Office 15.0 对象库”。好的,我的问题结束了。

我的代码的一部分是:

EXCEL.Range rango;
            rango = (EXCEL.Range)HojadetrabajoExcel.get_Range("AE13", "AK23");
            rango.Select();
      //      EXCEL.Pictures Lafoto = (EXCEL.Pictures).HojadetrabajoExcel.Pictures(System.Reflection.Missing.Value);
            EXCEL.Pictures Lafoto = HojadetrabajoExcel.Pictures(System.Reflection.Missing.Value);

            HojadetrabajoExcel.Shapes.AddPicture(@"D:\GENETICA HUMANA\Reportes\imagenes\" + Variables.nombreimagen,
                Microsoft.Office.Core.MsoTriState.msoFalse, Microsoft.Office.Core.MsoTriState.msoCTrue,
                float.Parse(rango.Left.ToString()),float.Parse(rango.Top.ToString()), float.Parse(rango.Width.ToString()),
                float.Parse(rango.Height.ToString()));

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:

EXCEL.Range rango;
            rango = (EXCEL.Range)HojadetrabajoExcel.get_Range("AE13", "AK23");
            rango.Select();
      //      EXCEL.Pictures Lafoto = (EXCEL.Pictures).HojadetrabajoExcel.Pictures(System.Reflection.Missing.Value);
            EXCEL.Pictures Lafoto = HojadetrabajoExcel.Pictures(System.Reflection.Missing.Value);

            HojadetrabajoExcel.Shapes.AddPicture(@"D:\GENETICA HUMANA\Reportes\imagenes\" + Variables.nombreimagen,
                Microsoft.Office.Core.MsoTriState.msoFalse, Microsoft.Office.Core.MsoTriState.msoCTrue,
                float.Parse(rango.Left.ToString()),float.Parse(rango.Top.ToString()), float.Parse(rango.Width.ToString()),
                float.Parse(rango.Height.ToString()));
放低过去 2024-11-12 17:05:49

当我尝试将旧的 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

北城孤痞 2024-11-12 17:05:49

就我而言,当我从 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.

執念 2024-11-12 17:05:49

我遇到了同样的问题,但 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:
enter image description here

path:C:\Program Files\Microsoft Office\root\vfs\ProgramFilesCommonX86\Microsoft Shared\Office16\MSO.DLL

After adding it, everything worked as expected.

半步萧音过轻尘 2024-11-12 17:05:49

就我而言,当我在 nuget 包中安装“MSOffice.Object.Library”时,引用错误消失了。

In my case when i installed "MSOffice.Object.Library" in nuget package, the reference error goes away.

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