Why does my App.Config codebase not help .NET locate my assembly?

Posted by pkolodziej on Stack Overflow See other posts from Stack Overflow or by pkolodziej
Published on 2009-04-14T17:12:57Z Indexed on 2010/05/17 7:10 UTC
Read the original article Hit count: 281

Filed under:
|
|
|

I have the following client application and its corresponding config file:

namespace Chapter9
{
    class Program
    {
        static void Main(string[] args)
        {
            AppDomain.CurrentDomain.ExecuteAssembly("AssemblyPrivate.exe");
        }
    }
}

<configuration>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <codeBase href="file://C:\Users\djpiter\Documents\Visual Studio 2008\Projects\70536\AssemblyPrivate\bin\Debug\AssemblyPrivate.exe"/>
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
</configuration>

The AssemblyPrivate.exe does not have a public key, nor is it located in the GAC. As far as I know, the runtime should parse the app.config file before looking for an assembly in the client app directory.

The unhandled exception (wrapped for readability) is:

Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly
'file:///C:\Users\djpiter\Documents\Visual Studio 2008\Projects\70536\Chapter9\bin\Debug\AssemblyPrivate.exe'
or one of its dependencies. The system cannot find the file specified.

Why it is not working? I need to use dynamic binding (not static).

Kind Regards, PK

© Stack Overflow or respective owner

Related posts about .NET

Related posts about codebase