Assembly Binding Redirection in .Net

Posted by Anuraj on Thursday, May 2, 2013 Reading time :1 minute

.Net .Net 4.0 ASP.Net Windows Forms

Today I come across an application crash due to version mismatch. The application executable was compiled using version 1.0.x.x, and we were using 6.2.x.x. Due to this version mismatch application was crashing.

Could not load file or assembly - error

Unfortunately we don’t have the source code of this application with us. Later I got one solution using bindingRedirect. This configuration element will help you to redirect referenced assemblies from one version to another using the app.config file.

<?xml version="1.0"?>
		<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
				<assemblyIdentity name="Microsoft.Ink" 
					publicKeyToken="31BF3856AD364E35" culture="neutral"/>
				<bindingRedirect oldVersion="" 

We fixed the problem by creating an application.exe.config file with binding redirection inside it. By doing this you are instructing the application or DLL that during runtime, for a particular dependent assembly to use a particular version when an application and/or other assembly is looking for the older version.

You can find more details about binding redirection in MSDN.

What do you think? I would like to hear your thoughts, suggestions, and questions in the comments section below.

Did you like this article? Share it with your friends

Facebook Twitter Google+ LinkedIn Reddit StumbleUpon

BMC logoBuy me a coffee

Copyright © 2019 - Anuraj P. Blog content licensed under the Creative Commons CC BY 2.5 | Unless otherwise stated or granted, code samples licensed under the MIT license. This is a personal blog. The opinions expressed here represent my own and not those of my employer. Hosted with ❤ by GitHub