BindingRedirect to different assembly name
Asked Answered
S

3

25

You can use BindingRedirect to redirect YourAssembly.dll 1.1.0.0 to 1.2.0.0.

Does anyone know if its possible to do this if the assembly names are different.

E.g.

YourAssembly1.dll (v1.1) redirects to YourAssembly2.dll (v2.8)

Sickroom answered 19/8, 2009 at 18:21 Comment(0)
P
11

If I recall correctly, I did this about 4 years ago using the AppDomain.AssemblyResolve event. The idea is that you get the AssemblyName request and you return an Assembly. In some cases, I was even able to generate DynamicAssembly at runtime and inject that. I forget what effects strong naming has on this.

Portiere answered 1/5, 2013 at 19:14 Comment(1)
Nice. I call this the binding redirect of shame!Lesko
O
0

Use ILDASM and ILASM to decompile, modify, and recompile the original assembly so it references YourAssembly2.dll.

I got the idea in my head and did a couple of searches to verify it's possible. See Is it possible to modify assembly manifests other than by ILDASM/ILASM hacking? and http://forums.asp.net/t/1582934.aspx/1

Overwhelming answered 1/5, 2013 at 16:5 Comment(0)
S
0

This should not be possible, due to the fact that your own application has a reference to YourAssembly1.

When the runtime loads your application it tries to load an assembly YourAssembly1.dll (applying probing and version redirects) and therefore it cannot load the assembly YourAssembly2 instead.

Sexdecillion answered 1/5, 2013 at 16:19 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.