How to remove path of my command line?

How do I get a C# file run from the command line to reference the Microsoft.Office namespace?

  • I am fairly new to C#, and primarily picked up the language to be able to write a solution which opens and reads Microsoft Office file types using the Microsoft.Office.Interop namespace.  At this point, I have written the solution, and when I debug a C# script using Microsoft Visual C# 2010 Express, it compiles and runs fine, successfully extracting the text from all Office file types. However, I have run into the persistent problem that when I try to compile the C# file from the command line, I get the error that "the type or namespace 'Office' does not exist in the namespace 'Microsoft'". Most of the advice I've found on fixing this relates to including a reference specifying the path of the Microsoft.Office.Interop.dll file when I run the command to compile, but I can't seem to find it anywhere in the suggested locations to check (such as C:\Window\Micrsoft.NET\assembly). If anyone has an idea of where I can find the dll file, or whether there is something else I need to do, that would be much appreciated.

  • Answer:

    In your solution, go to project right click menu, choose add references and add Microsoft.Office DLL.

Kanwaljit Singh at Quora Visit the source

Was this solution helpful to you?

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.