locked
Use GAC with managed dlls ? RRS feed

  • Question

  • Hello,

    we have an application in native C++. This application has also some managed dlls as wrappers for a plugin technology in C#.

    Currently all these dlls, native for the application, managed for the wrappers and C# for the plugins, have to be located in the application folder to make sure at runtime all dlls are found.

    Since this is not very comfortable, we want to add the managed dlls to GAC.

    First, there was no problem to add the managed dlls to the GAC.

    Then I tried to start the application via a plugin in the following way:

    A plugin, a C# exe file has references to the managed dlls in the GAC. But when trying to load these from GAC I got a FileNotFoundException, because the native dlls linked to the managed could not be found.

    Is there any solution for this problem ? How do the assembies in GAC locate their native linked dlls ?

    Thank you !

    Monday, March 12, 2007 8:45 AM

Answers

  • Yes there is a "unmanaged assembly" cache which is called Windows Side By Side (WinSxS folder inside your windows directory. The MFC Dlls are for example located there. You can have a look at your dependencies with depends to see from where your dlls would be loaded.

    Here is the relevant link:
    http://msdn2.microsoft.com/en-us/library/ms235532(VS.80).aspx

    You can use manifest files to "reference" your dependendant dlls in unmanaged code which are then loaded from the WinSxS folder and not via the normal dll search path method.

    Yours,
        Alois Kraus

    Monday, March 12, 2007 11:47 PM