ASP.NET assembly problem

Following is the directory structure

e: \ test \ probing

The directory profile contains an executable file [Probing.exe] that loads a DLL file (Probe.dll).

Code:

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 (Probe.dl) is located in a subdirectory (e: \ test \ probing \ CustomLibraries \ Probe.dll).

I provided Probing.exe.config file, even App.config to find the assembly.

The config file contains the following code:

<configuration>

<runtime>

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

<probing privatePath="CustomLibraries"/>

</assemblyBinding>

</runtime>

</configuration>

      

I am getting FileNotFound Exception until I keep the dll inside the Bin directory.

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

+2


source to share


1 answer


The first thing to do to debug this is setup Fusion logging - this way you will see the checked directories.

Investigation only works under subdirectories under your application directory, so if, as you say, your application is in ... \ bin and your libraries are in ... \ lib, that won't work - they must be in ... \ Bin \ Lib.



You need to use codebase instead

+4


source







All Articles