Deepak Sharma
Deepak Sharma

Reputation: 1

Redirect application to use another assemlby with different name

My .Net C# appliation is referencing a strong named dll,and my requiremnet is to redirect the application to use another dll with a different name ( version and key are same for both dlls), how can i achive this without recompiling the application.

Upvotes: 0

Views: 849

Answers (3)

Simon Mourier
Simon Mourier

Reputation: 139256

Here is the offical doc on this: Redirecting Assembly Versions (check out the "Specifying Assembly Binding in Configuration Files" section, this is the most easy to do)

Upvotes: 1

Jorge Córdoba
Jorge Córdoba

Reputation: 52133

You can't as far as i know. That's the beauty of it, strong named assemblies are produced with a signature, precisely to avoid what you're trying to do.

After all it wouldn't have much security if you could just substitute a DLL from another one and having the new DLL methods do whatever you want under the original caller context would it?

Upvotes: 0

Luke Duddridge
Luke Duddridge

Reputation: 4347

Reflection might be a solution.

At the point you know what dll you want to use pull in the dll by reflection.

If both dlls derive from the same interface then the rest of the code can be very generic no matter the dll you use.

Upvotes: 0

Related Questions