Can't locate Microsoft.Office.Interop.Word in Reference List

﹥>﹥吖頭↗ 提交于 2019-11-27 02:09:29

问题


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.


回答1:


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




回答2:


You need Microsoft Word xx Object Library.




回答3:


You can download the Primary Interop Assemblies from here.

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




回答4:


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.

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.




回答5:


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.



来源:https://stackoverflow.com/questions/16054184/cant-locate-microsoft-office-interop-word-in-reference-list

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!