Loading MFC dll from C# using VS2005 when copy to another computer

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Idit
    New Member
    • Jan 2007
    • 5

    Loading MFC dll from C# using VS2005 when copy to another computer

    Hi,

    I am running C# application with MFC. dll project.
    I managed to run the application when the VS2005 environment exists but when I copy the .exe and dll to another computer I get the following errer:

    An unhandled exception of type 'System.IO.File NotFoundExcepti on' occurred in FilesUpdateAppl ication.exe

    Additional information: Could not load file or assembly 'StrtData, Version=0.0.0.0 , Culture=neutral , PublicKeyToken= null' or one of its dependencies. The system cannot find the file specified.

    Please advice,
    Thanks
  • RedSon
    Recognized Expert Expert
    • Jan 2007
    • 4980

    #2
    The first thing you can do is check to see what version of .net framework your target machine has. Be sure that the environment that you coded in is the same or similar to what you are running the app in. Second it sounds like whatever your program does it does it on a hard coded input file. You may want to ask for that input from the user or make sure your input file is in the same directory as your program expects it to be in.

    Comment

    • Idit
      New Member
      • Jan 2007
      • 5

      #3
      Originally posted by RedSon
      The first thing you can do is check to see what version of .net framework your target machine has. Be sure that the environment that you coded in is the same or similar to what you are running the app in. Second it sounds like whatever your program does it does it on a hard coded input file. You may want to ask for that input from the user or make sure your input file is in the same directory as your program expects it to be in.

      I work on both woth .Net 2.0.
      When I remove the loading of the dll, it works fine and I don't parse any local files.
      The error is related to the dll name, maybe something related to the Assembly.
      Do you know if there is a special syntax for loading the dll?
      I just added it as a reference to the project and worked with it on my machine.



      Thank you
      Idit

      Comment

      • RedSon
        Recognized Expert Expert
        • Jan 2007
        • 4980

        #4
        Originally posted by Idit
        I work on both woth .Net 2.0.
        When I remove the loading of the dll, it works fine and I don't parse any local files.
        The error is related to the dll name, maybe something related to the Assembly.
        Do you know if there is a special syntax for loading the dll?
        I just added it as a reference to the project and worked with it on my machine.



        Thank you
        Idit
        The only thing I can think of with out delving into your code, is the regserv32 facility that Windows provides. Take a look at that, maybe you have to register your dll on the test system?

        Comment

        • Motoma
          Recognized Expert Specialist
          • Jan 2007
          • 3236

          #5
          Originally posted by RedSon
          The only thing I can think of with out delving into your code, is the regserv32 facility that Windows provides. Take a look at that, maybe you have to register your dll on the test system?
          Ooooh, good one.

          Idit: The other thing that might be happening is an issue with the working directory for the executable. When you compile and run in the VS2005 environment, the working directory for the program is actually the main project directory, however, when you run it outside VS2005, it is the directory the executable is located in.
          To diagnose this, try running the program on the same machine you built it on, but outside of the VS2005 environment.

          Comment

          Working...