BindingRedirect in a addin config file

Add-in Express™ Support Service
That's what is more important than anything else

BindingRedirect in a addin config file
 
JLuis Estrada




Posts: 5
Joined: 2015-10-01
It is possible to declare a bindingRedirect clause for a DLL in an addin config file? or this have to be done in outlook's config file
Posted 24 Nov, 2015 13:20:16 Top
JLuis Estrada




Posts: 5
Joined: 2015-10-01
Well, doing a bit of research Id found that it is not possible (unless you have created a workaround). Im working on a way to do it in runtime programmatically.

Ill let you know how it goes
Posted 24 Nov, 2015 13:30:04 Top
JLuis Estrada




Posts: 5
Joined: 2015-10-01
I case somebody come across a similar situation, the way to solve this problem is like this:

In the constructor of the module, add an event handler for this event

AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve;


And then, in the event handler, do something like this



private Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args)
        {
            var name = new AssemblyName(args.Name);
            if (name.Name == "Newtonsoft.Json")
            {
                return typeof(Newtonsoft.Json.JsonConvert).Assembly;
            }
            return null;
        }


In this method, Im telling the system to user the regular (updated) Newtownsoft.Json assembly instead of the required by the System.Net.Http.Formatting assembly (old version).
Posted 24 Nov, 2015 17:41:08 Top
Andrei Smolin


Add-in Express team


Posts: 18829
Joined: 2006-05-11
Thank you for sharing your findings!


Andrei Smolin
Add-in Express Team Leader
Posted 25 Nov, 2015 02:27:36 Top