8
votes

I'm using the Apache's version of log4net for logging stuff

1.2.10.0 (with PublicTokenKey=1b44e1d426115821)

But unfortunately SAP Crystal Reports use its own version of this library with another public token key (compiled with their own snk file):

1.2.10.0 (with PublicTokenKey=692fbea5521e1304)

Same version, different public token key. When I compile my solution I have a message telling me the following:

"No way to resolve conflict between "log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821" and "log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=692fbea5521e1304". Choosing "log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821" arbitrarily."

The worst thing is that I cannot deploy to a 64bit machine without installing the 32-bit version of Crystal Reports (which installs the log4net assembly on the GAC)

I took the Crystal's version of log4net from the GAC and the question is:

Will I solve anything if I start using the Crystal Reports' version (PublicTokenKey=692fbea5521e1304)?

and What if I want to use the next release of log4net (say v1.2.11.0)?

Is there any way to solve this the right way?

2
The crazy thing is, .net is arbitrarily picking the standard version of log4net, so the one that Crystal has compiled (and signed) themselves isn't even being used... So Crystal, why not just use / reference the officially signed one in your app instead seeing as that's what's happening anyhow?Tod Thomson

2 Answers

0
votes

Well, since log4net is open source, you could just compile it under a different name.

I'm not entirely sure if this will work, but I suspect you could also look into aliases. See also here.

0
votes

you add this code into App.config:

<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="CrystalDecisions.CrystalReports.Engine" publicKeyToken="692fbea5521e1304"/>
<bindingRedirect oldVersion="14.0.2000.0" newVersion="12.0.2000.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="CrystalDecisions.Shared" publicKeyToken="692fbea5521e1304"/>
<bindingRedirect oldVersion="14.0.2000.0" newVersion="12.0.2000.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="CrystalDecisions.ReportSource" publicKeyToken="692fbea5521e1304"/>
<bindingRedirect oldVersion="14.0.2000.0" newVersion="12.0.2000.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="CrystalDecisions.Windows.Forms" publicKeyToken="692fbea5521e1304"/>
<bindingRedirect oldVersion="14.0.2000.0" newVersion="12.0.2000.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="CrystalDecisions.Enterprise.Framework" publicKeyToken="692fbea5521e1304"/>
<bindingRedirect oldVersion="14.0.2000.0" newVersion="12.0.1100.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="CrystalDecisions.Enterprise.InfoStore" publicKeyToken="692fbea5521e1304"/>
<bindingRedirect oldVersion="14.0.2000.0" newVersion="12.0.1100.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>