2016-02-12

DLL-hell: log4net... oldKey vs newKey

Since log4net now comes in 2 flavours, namely oldkey and newkey, since the Development team decided to change the key, this may cause some trouble.

Here's my solution:

1) Update your Project by getting the latest version from nuget (currently 1.2.15.0) by using update (or other). This should get you the "newkey" version, which has publicKeyToken="669e0ddf0bb1aa2a". You can also download it from Apache.

2) Go to Apache and download the oldkey version (publicKeyToken="1b44e1d426115821"), and place it somewhere nice on your DEV PC.

3) Open a Developer Command Prompt for your version of Visual Studio, and run the GACUTIL utility to install the oldKey dll into the Global Assembly Cache (GAC).

4) Update the Runtime/assemblyBinding section of your config file (web.config  or App.config) With the following:

<dependentAssembly>       
  <bindingRedirect oldVersion="0.0.0.0-1.2.15.0" newVersion="1.2.15.0" />       
  <assemblyIdentity name="log4net" publicKeyToken="669e0ddf0bb1aa2a" culture="neutral" />     
</dependentAssembly>     

<dependentAssembly>
  <bindingRedirect oldVersion="1.0.0.0-1.2.15.0" newVersion="1.2.15.0" />
  <assemblyIdentity name="log4net" publicKeyToken="1b44e1d426115821" culture="neutral" />
</dependentAssembly>

Hope this helps!

No comments:

Post a Comment