Firstly, why the Hell would you change the public key of a strongly named assembly between versions?
Secondly, WHY THE HELL WOULD YOU CHANGE THE PUBLIC KEY? Jesus.
Yes, I've read http://logging.apache.org/log4net/release/faq.html#two-snks and that just reeks of the development team having some kind of argument with people outside of their anointed circle of coders.
Anyway, there's a requirement on some old CMS code in a project I'm working on, and the DLLs have got a reference to log4net 1.2.10 while the rest of the world is staring down the barrel of 1.2.13.
Incidentally, I think it's really bad form to put numbers into assembly names, and, further, to have version 1.2.13 to be a completely different NuGet version (2.0.3). Seriously, what the fuck?
I found this post which really helped - you can reference two different versions if they use a strong name as long as you stick them in different folders, whilst keeping a reference in the project to the later one but setting Copy Local to false. I also added a pre-build event on the website which would make the folders if they didn't exist and copy the appropriate DLLs into each.
http://stackoverflow.com/questions/3158928/referencing-2-differents-versions-of-log4net-in-the-same-solution
However, the finishing touch was that since this was an endpoint - i.e. a website where lots of DLLs are bundled up together - then it needed to have the right path; in this case, it needed "bin\" prepended to it:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<runtime> | |
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> | |
<dependentAssembly> | |
<assemblyIdentity name="log4net" publicKeyToken="1b44e1d426115821" culture="neutral" /> | |
<codeBase version="1.2.10.0" href="bin\log4net.1.2.10\log4net.dll" /> | |
</dependentAssembly> | |
<dependentAssembly> | |
<assemblyIdentity name="log4net" publicKeyToken="669e0ddf0bb1aa2a" culture="neutral" /> | |
<codeBase version="1.2.13.0" href="bin\log4net.1.2.13\log4net.dll" /> | |
</dependentAssembly> | |
</assemblyBinding> | |
</runtime> |
Currently reading:
No comments:
Post a Comment