none
using a C# .net dll in a C++ .net dll RRS feed

  • Question

  • I've created a dll in C# and I'm trying to using it in a C++ .net project, but everytime I run the application, I get a FileNotFoundException pointing to the C# dll.  Can anyone tell me what I'm doing wrong. 

    All works fine from VB .Net to C# .Net, but I only have the problem in the C++ project.

    Wednesday, June 29, 2005 4:11 PM

Answers

  • Where is the C# assembly located? Usually the application and any associated assemblies (in this case your C# assembly) need to be in the same directory.
    Wednesday, June 29, 2005 4:27 PM
    Moderator

All replies

  • Where is the C# assembly located? Usually the application and any associated assemblies (in this case your C# assembly) need to be in the same directory.
    Wednesday, June 29, 2005 4:27 PM
    Moderator
  • The C# assembly is located in the same directory as the C++ assembly, but the problem still exists.  I'm wondering if there is a property setting I need to change in the C++ project properties.

    Also, what might be related to the problem, I'm using an external function in the C++ dll that is calling the C# assembly.  But I have used the MessageBox::Show function in place of the C# assembly call, and all worked fine.



    Here is the code I'm using:

    extern "C" int InitializeUserModule(int ParentWnd)

       //Code from the C# assembly
       System::Windows::Forms::Form *parent =
    new MyClass::frmMain();
       parent->ShowDialog();

       return 0;
    }


    //This code worked fine
    extern
    "C" int InitializeUserModule(int ParentWnd)

       MessageBox::Show("bla bla");

       return 0;
    }

    //This code generated the error before the message box popped up.
    extern "C" int InitializeUserModule(int ParentWnd)

       MessageBox::Show("bla bla");

       System::Windows::Forms::Form *parent = new MyClass::frmMain();

       return 0;
    }

    Friday, July 8, 2005 1:53 PM