none
error CS0234: The type or namespace name 'Office' does not exist in the namespace 'Microsoft'

    Question

  • I'm running Team Build 2008 trying to build a VS2010 solution (using this method http://www.richard-banks.org/2009/11/how-to-build-vs2010-solutions-using.html)

    We have a Interop.Microsoft.Office.Core.dll file that we reference from our solution. When I build the solution manually from VS2010, it compile fine with some warnings; however when I use MSBuild I get the following warnings and errors:

    C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1360,9): warning MSB3245: Could not resolve this reference. Could not locate the assembly "Interop.Microsoft.Office.Core, Version=2.3.0.0, Culture=neutral, processorArchitecture=MSIL". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors.
    C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1360,9): warning MSB3247: Found conflicts between different versions of the same dependent assembly.
    Components\Common\PDFBroker.cs(15,17): error CS0234: The type or namespace name 'Office' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)

    In the code, we have

    using Microsoft.Office.Core;

     

    Can someone help me to get the solution to compile correctly with MSBuild?

    • Moved by Yi Feng Li Friday, July 22, 2011 5:53 AM TFS build issue (From:MSBuild)
    Wednesday, July 20, 2011 10:01 PM

All replies

  • Hello,

    As far as I know, the office related assembly is not included in the .net framework 4. You need to install VS2010 on your server to build your application.

    Regards,

    Yi


    Yi Feng Li [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Thursday, July 21, 2011 1:46 PM
  • I do have VS2010 installed on the build machine along with the office components; however, the solution references a separate Interop.Microsoft.Office.Core.dll file that we keep around. The second warning mentions a conflict and I wonder if it is our Core.dll file conflicting with the installed office components that comes with VS2010.
    Thursday, July 21, 2011 4:07 PM
  • Hi,

    Since this question is high related to TFS build automation, I'm moving this thread to TFS build forum for better support.

    Yi


    Yi Feng Li [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Friday, July 22, 2011 5:52 AM
  • Hi,

    You just need to install the Microsoft Office 2010 Primary Interop Assemblies (PIA) on the build server.

    Thanks

    M.Radwan


    We are volunteers, if the reply help you mark it as your answer. thanks!!
    My Blog
    Saturday, July 23, 2011 10:17 PM
  • Thanks M.Radwan for your kindly help.

    Hello StormtrooperDan,

    Thanks for your post.

    Have you tried M.Radwan’s suggestion? And please also install the Office XP PIAs to see if can help you with your issue: http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=227

    Thanks.


    Vicky Song [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, July 25, 2011 6:18 AM
  • After I installed the the 2010 PIAs, I still go the same error.

    Does Office XP PIA provide the version below?

    Interop.Microsoft.Office.Core, Version=2.3.0.0

    I'll install and try the build again

    Monday, July 25, 2011 4:42 PM
  • I'm still getting the same error after installing the Office XP PIA.
    Monday, July 25, 2011 6:12 PM
  • Hello StormtrooperDan,

    I am sorry you do not have your issue resolved.

    For one thing I want to clarify with you: do you mean you can use VS2010 to build your solution on the TFS2008 build server successfully?

    Thanks,


    Vicky Song [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Tuesday, July 26, 2011 9:54 AM
  • u must add reference to your project from project >> add reference without id u won't be able to run any Office add-on  
    Saturday, August 13, 2011 3:46 PM
  • u must add reference to your project from project >> add reference without id u won't be able to run any Office add-on  

     

    The following error occured
    System.Runtime.InteropServices.COMException (0x80040154): Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).

     

    Please help me.

    Thanks

    Dhanunjay

    • Edited by PDhanunjay Thursday, January 05, 2012 11:24 AM
    Thursday, January 05, 2012 10:53 AM