Search code examples
c#.netreferencems-wordoffice-interop

Unable to add Microsoft Office Interop Assembly to Project


I marked this question as 'not a duplicate' because the answer to the other question did not solve my problem. this question does contain an answer which helped me (second answer down, about the object library), however I was still unable to add the required reference after this.

As the below answer suggested, I checked in C:/Windows/Assembly and found a load of MSIL files. When checking these in Visual Studio (under Project - Add Reference) I couldn't find them as they are not DLLs and the folder structure had completely changed.

However, running a search here for Microsoft.office.interop.word allowed me to find the DLL and add it to the project.

Hooray!


I need to add the following using directive to my project in order to programmatically convert word documents to pdf:

using Microsoft.Office.Interop.Word;

However, no matter what I do I can't seem to find the dll or reference assembly:

enter image description here

As you can see, I do have office installed on my machine as well:

enter image description here

No matter where I look online, the only answer seems to be "make sure you have word installed", which is not helpful as I clearly do!


Solution

  • It should be somewhere in C:\Windows\assembly\

    Edited my answer due to below question should people have the same issue in future.

    Browse (when adding a new Reference) > go to C:\Windows\assembly\ > GAC_MSIL > Microsoft.Office.Interop. > Office version > Dll should be there