[ACCEPTED]-Resolve assembly references from another folder-assembly-resolution

Accepted answer
Score: 14

You should first find the folder where theses 7 dlls are installed then use AppDomain.AssemblyResolve to hook assembly 6 resolution and try to load the requested 5 assemblies from this folder.

It will look 4 something like this (not tested, and you 3 need to check what args.Name contain exactly, could 2 contain the version and the strong name 1 along with type name) :

var otherCompanyDlls = new DirectoryInfo(companyFolder).GetFiles("*.dll");

AppDomain.CurrentDomain.AssemblyResolve += (sender, args) =>
{
    var dll = otherCompanyDlls.FirstOrDefault(fi => fi.Name == args.Name);
    if (dll == null)
    {
        return null;
    }

    return Assembly.Load(dll.FullName);
};
Score: 0

Use SN.exe : SN -T VendorAssembly.dll, this will 6 return a hex number that is the public key 5 token, then, reference the assembly from 4 app.config. To get the version right click 3 your vendor assembly and use that for the 2 codeBase version value, the href=path you 1 mentioned.

  <configuration>
       <runtime>
          <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
             <dependentAssembly>
                <assemblyIdentity name="VendorAssembly"  culture="neutral" publicKeyToken="307041694a995978"/>
                <codeBase version="1.1.1.1" href="FILE://D:/ProgramFiles/VendorName/ProductName/Support/API/Bin64/VendorAssembly.dll"/>
             </dependentAssembly>
          </assemblyBinding>
       </runtime>
    </configuration>

More Related questions