25

I was given this solution to a problem I had, since I didn't know how to integrate MS Word with C#: http://www.dotnetperls.com/word

I looked into this solution, and I can't locate Microsoft.Office.Interop.Word in the reference list. I can't find it under COM Objects either. What am I missing? I am using Visual Studio Express 2012.

EDIT:

The answer to this question is that you HAVE to install MS Office on your computer.

Moradnejad
  • 3,466
  • 2
  • 30
  • 52
OmniOwl
  • 5,477
  • 17
  • 67
  • 116
  • 3
    No, actually you don't NEED to install office. This answer http://stackoverflow.com/a/19572022/243557 is more correct than the one you have marked. – nathanchere Nov 13 '13 at 06:11
  • 1
    @nathanchere - No, actually we NEED to install office. That PIAs junk does nothing. No needed COm libs appears where they should. – Kosmo零 May 20 '16 at 16:26

5 Answers5

44

You need Microsoft Word xx Object Library.

enter image description here

Mike Chaliy
  • 25,801
  • 18
  • 67
  • 105
18

You can download the Primary Interop Assemblies from here.

http://www.microsoft.com/en-us/download/details.aspx?id=3508

Vadois
  • 251
  • 3
  • 9
18

You may also use NuGet Package Manager in order to install the reference. Go to Project -> Manage NuGet Packages... Search for "Interop.Word" and install that package.

enter image description here Good thing about it is that you don't need to think about where the dll is located. When another person will check out the solution, NuGet will get all needed packages onto their machine.

Roman
  • 1,727
  • 1
  • 20
  • 28
8

you might need to install the assemblies separately,if you did not choose to install them during your office installation.

MSDN:

You must install the Microsoft Office primary interop assemblies (PIAs) in the global assembly cache of your development computer before you can perform certain development tasks. Typically, the PIAs are installed automatically when you install Office on the development computer. However, in some cases you might need to install the PIAs separately.

More here

Prabhu Murthy
  • 9,031
  • 5
  • 29
  • 36
4

Check if the library (Microsoft.Office.Interop.word) is present in the assembly folder of windows (C:\Windows\assembly) else you can install it from http://www.microsoft.com/en-us/download/details.aspx?id=3508

Now you just need locate it in your visual studio.

Right click on the consoleApplication(or name of you application) in SolutionExplorer window and

Go to Add -> References-> Browse and find C:\Windows\assembly\GAC_MSIL\Microsoft.Office.Interop.word or similar directory. press ok and your can now use the library in your application.

alphaguy
  • 540
  • 3
  • 17
  • This question is like 4 years old. Not only that but a solution was already found because the interops you refer to there didn't work. – OmniOwl Jun 02 '17 at 15:01
  • @Vipar i had same problem and none of the above solutions helped me .After a lot of digging this is the way i solved the problem that's why i posted my answer. – alphaguy Jun 05 '17 at 04:04