none
How to define the path to Interop.*.dll RRS feed

  • Question

  • So I've ran into an issue in an application I'm working on. This application consists of an exe and a bunch of "plugin" dlls. The Plugins are in a subfolder called plugins in the exes directory ie:

    ..\myapp\myapp.exe
    and
    ..\myapp\plugins\plugin1\plugin1.dll

    now this works all well and good but I have one plugin that has a refrence to a c++ dll. I added the refrence to that plugins project and it made the interop.dllname.dll files as expected. The problem I've ran into is when I run the application and I have the interop files in the driectory with the dll that refrences it the exe reports the following exception:

    "Could not load file or assembly 'Interop.dllname, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" or one of its dependencies. The system cannot find the file specified."

    Now if I move the interop files to the applications root directory ie from
    ..\myapp\plugins\plugin1\interop.dllname.dll
    to
    ..\myapp\interop.dllname.dll

    everything works fine.

    So how do I tell it where to find this file I would like it to stay with the dll that refrences it if at all possible.

    Thank you,
    Dan
    Monday, February 4, 2008 9:46 PM

Answers

  • You can add a probing path to your managed executables App.config file. But be aware that it is not possible to use relative paths names that step above the directory where the executable is located.


    The following example shows how to specify application base subdirectories the runtime should search for assemblies.

    Code Snippet

    The following example shows how to specify application base subdirectories the runtime should search for assemblies.

    <configuration>
       <runtime>
          <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
             <probing privatePath="bin;bin2\subbin;bin3"/>
          </assemblyBinding>
       </runtime>
    </configuration>



    Yours,
      Alois Kraus


    Tuesday, February 5, 2008 12:19 AM

All replies

  • I forgot to mention that the exe and the plugins are all written in C# 2005
    Monday, February 4, 2008 9:53 PM
  • You can add a probing path to your managed executables App.config file. But be aware that it is not possible to use relative paths names that step above the directory where the executable is located.


    The following example shows how to specify application base subdirectories the runtime should search for assemblies.

    Code Snippet

    The following example shows how to specify application base subdirectories the runtime should search for assemblies.

    <configuration>
       <runtime>
          <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
             <probing privatePath="bin;bin2\subbin;bin3"/>
          </assemblyBinding>
       </runtime>
    </configuration>



    Yours,
      Alois Kraus


    Tuesday, February 5, 2008 12:19 AM
  • Ok great that works thanks.

    One last related question is there a way to spesifiy a wildcard in the probing path? Is it possible to say the probing path should search every subdir in subbin? The reasion I ask is i'm trying to make it so that the plugins can be contained in their own folder in the plugin directory ie plugins\plugin1\plugin1.dll but I don't nessisaraly know the plugins subdir (plugin1) when I build/release my app. So what I would like to do is say probe all subdirs in plugins for example.

    Thank you
    Tuesday, February 5, 2008 7:29 PM
  • Sorry,

     

    no you must specify the directories explictely.

     

    Wednesday, February 6, 2008 8:32 AM