views:

671

answers:

1

The following is my directory structure

e:\test\probing

The directory probing containts an executable [Probing.exe] which loads the dll file ( Probe.dll).

The code is :

namespace Probing

  {
     class Program

     {
        static void Main(string[] args)

        {

                Assembly asm = Assembly.Load("Probe.dll");

                if (asm != null)

                {

                    Console.WriteLine("Assembly Probe is loaded");

                }

                else

                {
                    Console.WriteLine("Assembly Probe is not loaded");
                }

        }
    }
}

The dll file is (Probe.dl) residing in the sub directory ( e:\test\probing\CustomLibraries\Probe.dll ).

I supplied Probing.exe.config file,even App.config to locate the assembly.

The configuration file contains the following code :

<configuration>

<runtime>

<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">

<probing privatePath="CustomLibraries"/>

</assemblyBinding>

</runtime>

</configuration>

I am receiving FileNotFound Exception untill i keep the dll inside the Bin dir.

I need your help.( I am using Visual studio 2008 )

+1  A: 

First thing to do with trying to debug this is to setup Fusion logging - that way you'll see the directories checked.

Probing only works for subdirectories below your application directory, so if, as you say, your app is in ...\bin and your libraries are in ...\lib it won't work - they need to be in ...\bin\lib.

You need to use codebase instead

blowdart