What is the best approach to use 3rd party that uses another version of other 3rd party (log4net) already used in the system?
- Currently we use log4net of version 1.2.10.0 and we should start using some 3rd party components dev开发者_运维问答eloped by other team.
- Mentioned component references log4net of version 1.2.9.0.
- All binaries are deployed into one folder.
I'm sure that we cannot rebuild our sources with 1.2.9.0 version, because there are too many other dependencies and will require lot of efforts. Are there any other approaches to solve this issue? I'm NOT looking for too sophisticated that have something to do with CLR assemblies loading, but would hear them with great pleasure. I'm looking for the simplest approaches. I guess someone has encountered the same issue.
EDITED: If someone got interested I created blog post on this: http://andriybuday.blogspot.com/2010/10/log4net-versions-deployment-issue.html
EDITED2: So, this edit is not answer, but it represents unexpected end of this story. I just copied it from blog post.
FUNNY-HAPPY-END OF THIS STORY
Do you know what is the most interesting about all of this? It is how it has finished. We contacted those guys, who developed component we now should use. They gave us know, that they were encountering issues with updating on-the-fly configuration file for log4net 1.2.10.0. By their words, new version of log4net is not capable of doing this. So they sent as simple application that demonstrates this, and indeed, after updating config when app is running, 1.2.10.0 did not catch up new configuration, but 1.2.9.0 was working just fine. This surprised me very much, so I went to this download page and downloaded latest binaries. When I tried it got working!!! Actually I guess that they simply used version of log4net buit with references to .net framework 1.1, and we should use one built with .net 2.0 (Yeah! Actually if you would download you will see.)
After all of this, they created new sub-release of their sources especially for us and they were able to fix some minor bug. Great news! Unexpected end of story! :)
The recommended approach would be to install both versions of log4net into the Global Assembly Cache (GAC).
If however you can't change the requirement of loading all assemblies from a single folder, it is probably easiest to rename the copy of log4net used by your projects and reference the renamed version.
I don't know what the changes are between the two versions (we use 1.2.10.0 ourselves) but if the interfaces have not changed then you could try an assembly redirect to the newer version:
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="log4net"
publicKeyToken="b32731d11ce58905"
culture="neutral" />
<bindingRedirect oldVersion="1.2.9.0"
newVersion="1.2.10.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
Make sure that the key is the same as the one I provided as they may have changed between the two.
http://msdn.microsoft.com/en-us/library/7wd6ex19(VS.71).aspx
精彩评论