[c#] Microsoft.Office.Core Reference Missing

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?

This question is related to c# outlook automation com ms-office

The answer is


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.


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


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/


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()));

Open the properties of the solution and click publish. Then, reclick application files. Change prerequisite to include.


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).


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!


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.


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
    

After installing the Office PIA (primary interop assemblies), add a reference to your project -> its on the .NET tab - component name "Office"


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.


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


Examples related to c#

How can I convert this one line of ActionScript to C#? Microsoft Advertising SDK doesn't deliverer ads How to use a global array in C#? How to correctly write async method? C# - insert values from file into two arrays Uploading into folder in FTP? Are these methods thread safe? dotnet ef not found in .NET Core 3 HTTP Error 500.30 - ANCM In-Process Start Failure Best way to "push" into C# array

Examples related to outlook

Does VBA contain a comment block syntax? "Sub or Function not defined" when trying to run a VBA script in Outlook Change HTML email body font type and size in VBA css padding is not working in outlook Image style height and width not taken in outlook mails Paste Excel range in Outlook MS Access VBA: Sending an email through Outlook HTML email in outlook table width issue - content is wider than the specified table width Save attachments to a folder and rename them Sending email from Command-line via outlook without having to click send

Examples related to automation

element not interactable exception in selenium web automation Upload file to SFTP using PowerShell Check if element is clickable in Selenium Java Schedule automatic daily upload with FileZilla How can I start InternetExplorerDriver using Selenium WebDriver How to use Selenium with Python? Excel VBA Automation Error: The object invoked has disconnected from its clients How to type in textbox using Selenium WebDriver (Selenium 2) with Java? Sending email from Command-line via outlook without having to click send R command for setting working directory to source file location in Rstudio

Examples related to com

Class not registered Error The #include<iostream> exists, but I get an error: identifier "cout" is undefined. Why? How can I generate UUID in C# How to repair COMException error 80040154? BSTR to std::string (std::wstring) and vice versa Microsoft.Office.Core Reference Missing System.Runtime.InteropServices.COMException (0x800A03EC) Error 80040154 (Class not registered exception) when initializing VCProjectEngineObject (Microsoft.VisualStudio.VCProjectEngine.dll) How to handle AccessViolationException Register 32 bit COM DLL to 64 bit Windows 7

Examples related to ms-office

How to read data from excel file using c# Excel 2007: How to display mm:ss format not as a DateTime (e.g. 73:07)? What do <o:p> elements do anyway? Access Database opens as read only Microsoft.Office.Core Reference Missing What is a correct MIME type for .docx, .pptx, etc.? VBA: How to display an error message just like the standard error message which has a "Debug" button? How to detect installed version of MS-Office? How can I programmatically freeze the top row of an Excel worksheet in Excel 2007 VBA? Where does VBA Debug.Print log to?