Redirecting Assembly Version

How Can We Help?

Redirecting Assembly Version

< Back

Scenario:

  1. You upgraded the XMPro website to a later version with a custom library that has a reference to the older version of XMPro assembly.
  2. You have upgraded the XMPro website to a later version with a custom library that has a reference to the different version of referenced assembly.
  3. In both cases, you want to use the same assembly without recompiling against the new referenced assembly. For instance, using Newtonsoft.Json.dll to serialize / de-serialize json object. However, XMPro 6.7 is referenced to Newtonsoft.Json.dll version 8, but you might use version 12 in your custom library solution.

Solution:

Edit the web.config to resolve the assembly referencing issues by redirecting the library to use the newer version of the assembly. By adding the following XML inside the <assemblyBinding xmlns=”urn:schemas-microsoft-com:asm.v1″> tag:

   <dependentAssembly>
        <assemblyIdentity name="someAssembly" publicKeyToken="32ab4ba45e0a69a1"culture="neutral" />  
        <bindingRedirect oldVersion=0.0.0.0.7.0.0.0" newVersion="8.0.0.0" />
   </dependentAssembly>

For example, with reference to a XMPro library:

   <dependentAssembly>
        <assemblyIdentity name="XMPro.XMServer.Core"publicKeyToken="a79c0da5e4528976" culture="neutral"/>
        <bindingRedirect oldVersion="0.0.0.0-6.7.0.0" newVersion="6.7.0.0"/>
   </dependentAssembly>

The Version, Culture and PublicKeyToken information can be found by running the PowerShell cmdlet below.

([system.reflection.assembly]::loadfile(“C:\temp\xxxxxxx.dll”)).FullName

For example:

Comments are closed.

This is the legacy version of the XMPro Documentation site. For the latest XMPro documentation, please visit documentation.xmpro.com

X