none
type or namespace 'office' does not exist

    Question

  • While trying to build a C# solution in Visual Studio 2012, I get the following error: "The type or namespace 'office' does not exist in the namespace 'Microsoft'".

    What dlls do I need to add and where can I find/download these?

    Thanks.

    Wednesday, November 13, 2013 8:50 PM

Answers

  • OK, so take a look at that post about how to add a reference: http://msdn.microsoft.com/en-us/library/vstudio/wkze6zky.aspx

    Basically, in your solution do this:

    • Right click the "References" section and from the context menu choose "Add Reference..."
    • In the dialog that opens, click on the "Assemblies" option in the left hand nav, that will show you a long list of assemblies installed on your machine
    • In the "Search Assemblies" textbox (upper right corner), type in "Office", that will filter the list down to anything with Office in the title
    • The results will be in alphabetical order, and you should see "Microsoft.Office.Server" in the list
    • If using Visual Studio 2012, place a check next to it and click OK
    • You will see it listed in your "References" in your project

    Brandon Atkinson
    Blog: http://brandonatkinson.blogspot.com

    • Marked as answer by k_ve Thursday, November 14, 2013 6:25 PM
    Thursday, November 14, 2013 4:05 PM

All replies

  • There isn't enough detail in that error to tell which assemblies you need to add.  You should be able to see some classes in your code with squiggly lines under it, this is an indication the reference is missing.  Which classes have these lines?

    Or, do you have any "using" statements in your code that start with "Microsoft.Office"?

    In the end, you'll need to add a reference to the assemblies using the Add Reference in Visual Studio: http://msdn.microsoft.com/en-us/library/vstudio/wkze6zky.aspx


    Brandon Atkinson
    Blog: http://brandonatkinson.blogspot.com

    Thursday, November 14, 2013 12:16 AM
  • Thanks for you reply Brandon.
    I have a using statement that reads: "using Microsoft.Office.Server.Utilities;"

    I assume that this means I will need the add the Microsoft.Office.Server dll.

    Thursday, November 14, 2013 2:15 PM
  • OK, so take a look at that post about how to add a reference: http://msdn.microsoft.com/en-us/library/vstudio/wkze6zky.aspx

    Basically, in your solution do this:

    • Right click the "References" section and from the context menu choose "Add Reference..."
    • In the dialog that opens, click on the "Assemblies" option in the left hand nav, that will show you a long list of assemblies installed on your machine
    • In the "Search Assemblies" textbox (upper right corner), type in "Office", that will filter the list down to anything with Office in the title
    • The results will be in alphabetical order, and you should see "Microsoft.Office.Server" in the list
    • If using Visual Studio 2012, place a check next to it and click OK
    • You will see it listed in your "References" in your project

    Brandon Atkinson
    Blog: http://brandonatkinson.blogspot.com

    • Marked as answer by k_ve Thursday, November 14, 2013 6:25 PM
    Thursday, November 14, 2013 4:05 PM