Runtime Assembly Binding Redirect (Multiple Websites - Multiple DLLs Dilemma)

-------------------------------------------------------
Goto blog home
Visit my new blog dedicated to Internet of Things, Embedded Programming & Automation
-------------------------------------------------------
Suppose you have to use the latest version of a DLL without compiling the project. Or it might be that there are mulple versions of a DLL in the web server Global Assemble Cache (GAC) and there are multiple web applications hosted on this server and

<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="CrystalDecisions.CrystalReports.Engine"
publicKeyToken="692fbea5521e1304"
culture="neutral" />
<bindingRedirect oldVersion="10.2.3600.0"
newVersion="11.5.3700.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

The beauty of this version redirecting also allows you to provide a range in the oldVersion property, so you could point all previous version of a DLL to a particular version!

<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="CrystalDecisions.CrystalReports.Engine"
publicKeyToken="692fbea5521e1304"
culture="neutral" />
<bindingRedirect oldVersion="1.0.0.0-11.0.0.0"
newVersion="11.5.3700.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

No comments:

Post a Comment