简体   繁体   中英

Cannot find Microsoft.Office.Interop Visual Studio

I need to develop an application which will has the capability to send emails using C# with visual studio. The app will be able to use templates for mail, and a lot of things, but I have a problem.

I cannot find any Office.Interop references when I try to add them, which is mean I cannot work with Outlook. Office is installed on my computer, but i also try to install the PIA from this link http://www.microsoft.com/en-us/download/details.aspx?id=3508 but it didn't change anything (when I launch the MSI it stops without a word, I don't know if it's part of the problem).

I use VS 2013 express is it part of its limitation?

Look for them under COM when trying to add the references. You should find the reference below, and possibly Microsoft Outlook 15.0 Object Library, if you need that. There are similar libraries for Word, Excel, etc.:

在此输入图像描述

Update: The Object Library should contain the Interop stuff. Try to add this to a source file, and see if it does not find what you need:

using Microsoft.Office.Interop.Outlook;

在此输入图像描述

如果您使用的是Visual Studio 2015并且遇到此问题,则可以在此处安装VS Office的MS Office Developer Tools。

I forgot to select Microsoft Office Developer Tools for installation initially. In my case Visual Studio Professional 2013 and also 2015.

在此输入图像描述

With Visual Studio 2015 I have activated it with the following steps.

  1. Programs and Features --> Select Visual Studio > Change
  2. Choose Modify
  3. Windows and Webdevelopment --> Tick "Microsoft Office Developer Tools"
  4. Start Update

It should work now.

You can find it at link:

C:\\Windows\\assembly\\GAC_MSIL\\Microsoft.Office.Interop.Word\\15.0.0.0__71e9bce111e9429c\\Microsoft.Office.Interop.Word.dll

Browse it then add references

If you have installed latest Visual studio and want to To locate library of Microsoft.Office.Interop.Outlook or any other Microsoft.Office.Interop library then you should look into below 2 folders:

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

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

Please note that folder could be C:\\Program Files\\

I think you need to run that .msi to install the dlls. After I ran that .msi I can go to (VS 2012) Add References > Assemblies > Extensions and all of the Microsoft.Office.Interop dlls are there.

On my computer the dlls are found in "c:\\Program Files(x86)\\Microsoft Visual Studio 12.0\\Visual Studio Tools for Office\\PIA" so you could check in a similar/equivalent directory on yours just to make sure they're not there?

You need to install Visual Studio Tools for Office Runtime Redistributable:

http://msdn.microsoft.com/en-us/library/ms178739.aspx

I had the same issue with Visual Studio Community 2013, I fixed it downloading and installing the latest update of Office Developer Tools for Visual Studio 2013. Now I am able to see the whole Microsoft.Office.Interop.* list when I go to

Add References > Assemblies > Extensions

you can download it from here:

https://www.visualstudio.com/en-us/news/vs2013-update4-rtm-vs.aspx#Office
http://aka.ms/OfficeDevToolsForVS2013

Just doing like @Kjartan.

Steps are as follows:

  1. Right click your C# project name in Visual Studio's "Solution Explorer";

  2. Then, select "add -> Reference -> COM -> Type Libraries " in order;

  3. Find the "Microsoft Office 16.0 Object Library", and add it to reference (Note: the version number may vary with the OFFICE you have installed);

  4. After doing this, you will see "Microsoft.Office.Interop.Word" under the "Reference" item in your project.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM