Can't bind to an private assembly using relative path RRS feed

  • Question

  • User1904516115 posted

    How to use codebase setting for private assembly?  I ama getting following error.

    Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly 'ClassLibrary10' or one of its dependencies. The system cannot find the file specified.

    <?xml version="1.0" encoding="utf-8" ?> <configuration> <runtime> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <dependentAssembly> <assemblyIdentity name="ClassLibrary10"/> <codeBase href="test/ClassLibrary10.dll"/> </dependentAssembly> </assemblyBinding> </runtime> </configuration> Program.cs using System; using System.Reflection; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { Assembly assembly = Assembly.Load("ClassLibrary10"); Console.WriteLine(assembly.CodeBase); } } }

    Saturday, January 27, 2018 2:55 PM

All replies

  • User-1838255255 posted

    Hi vinodkpasi,

    According to your description and error message, as far as i know, this issue meaning is can not found ClassLibrary10 dll, also checked your code, your href isn't the relative path inside codeBase tag, you need add the corresponding character according to the following tutorial: 

    \ represent in the root directory. 

    .\ represent in the current directory. 

    ..\ represent the upper level directory. 

    Also here is a complete tutorial about implement this, please check:

    Assemblies: locating, binding and deploying


    Best Regards,

    Eric Du 

    Monday, January 29, 2018 11:47 AM