Search code examples
.net.net-assemblygoogle-drive-apimachine.configassembly-binding-redirect

bindingRedirect in Shell Extension Not Working


I wrote a shell extension that calls Google Drive API v2 to download files. It complains about assembly version, namely it required to have System.Net.Http.Primitives, Version=1.5.0.0, even though there is a bindingRedirect rule already in the .dll.config file. Also note that the same bindingRedirect works perfectly when placed in the machine.config file. Is this some kind of a bug?


Solution

  • I solved the problem by writing this:

     AppDomain.CurrentDomain.AssemblyResolve += (sender, args) =>
     {
          var assembly = Assembly.Load("System.Net.Http.Primitives");
    
          return assembly;
     };