Visual Basic > Visual Basic Forums > Visual Basic General > Getting errors when running or installing a VB.NET program with 2007 Office in a non.NET environment with office XP/2003
Ask a questionAsk a question
 

AnswerGetting errors when running or installing a VB.NET program with 2007 Office in a non.NET environment with office XP/2003

  • Wednesday, November 04, 2009 8:40 PMnovsaggi Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    As per my client's request I had to make a small program referencing excel and access files in .NET 2008

    My program is in Windows Vista, VB.NET, and the files are standard extensions, XLS & MDB, however Office 2007 is used. 

    Now I am having 2 issues

    1. If i just transfer my exe file to non .NET and with Office 2003/XP, I receive errors 
    System.IO.FileNotFoundException: Could not load file or assembly 'Interop.Excel, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
    File name: 'Interop.Excel, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'
    2. If I try to install, I receive error, unable to install.
    The error is
    Unable to install or run the application.
    The application requires that assembly office Version 12.0.0.0 be installed in the Global Assembly Cache (GAC) first.
    Please contact your system administrator*

    Currently the only measure I have taken is compiling in x86.
    I have browsed through all the forums, but cannot seem to find an answer which works for me 

    I will really appreciate anyone helping me out here. 

    Thanks in Advance for posting back.

Answers

All Replies

  • Wednesday, November 04, 2009 9:53 PMDJ PIP Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Hi there,

    I am by no means an expert when it comes down to using Office functions in a program (I've only done the basics), but I think the problem simply is that you have referenced the Office 2007 .dlls and the computer your installing your application on, doesn't have these because Office XP/2003 is installed and not the later 2007 versions of the dlls that your program is looking for, hence giving you the ...

    System.IO.FileNotFoundException: Could not load file or assembly 'Interop.Excel, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.

     ....problem.

    I don't think they are backwards compatiable either, you either need to install Office 2007 on the machines that you deploy your application on, or install office 2003 on your development machine and re-reference the older .dlls in order to make it work when you install it somewhere else.

    Perhaps you can package the newer 2007 dlls with your app? - (Not a clue if this is possible.)

    I hope this helps somewhat in answering your question,
    Hopefully someone with more experience can help.

    DJ PIP
  • Wednesday, November 04, 2009 10:14 PMBalaji Baskar Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer

    You could build a Setup project from Visual Studio and install your application anywhere.

    You could get help from the following link:

    http://www.dreamincode.net/forums/showtopic58021.htm


    Balaji Baskar [Please mark the post as answer if it answers your question]
    • Marked As Answer bynovsaggi Wednesday, November 04, 2009 11:18 PM
    •  
  • Wednesday, November 04, 2009 11:18 PMnovsaggi Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Well first of all Thank You for helping me here. 
    This immediately solved a big problem for me

    However, now that I can run steup and install the program 
    I am getting the following error

    System.NullReferenceException: Object reference not set to an instance of an object.
       at ManualJ.HVAC.Submit_Click(Object sender, EventArgs e)
       at System.Windows.Forms.Control.OnClick(EventArgs e)
       at System.Windows.Forms.Button.OnClick(EventArgs e)
       at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
       at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
       at System.Windows.Forms.Control.WndProc(Message& m)
       at System.Windows.Forms.ButtonBase.WndProc(Message& m)
       at System.Windows.Forms.Button.WndProc(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
       at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

    I am unable to understand which object is this error pointing to ?
    Can you help in that ?

    Thanks a ton again