Why does my App.Config codebase not help .NET locate my assembly?
- by pkolodziej
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