Due to a serious headache with log4net’s strong naming and versioning, i.e., the old 1.2.10 name, the new 1.2.11 name, and (heaven help me) the 1.2.10 one SAP made and shoved into the GAC with its own strong name, my application will refuse to run on any machine but my own. It keeps looking for version 1.2.11 of the strongly named SAP version, which doesn’t exist.
As nothing in my project is strongly named, I want to stop the compiler from looking for a strongly named assembly and just load the one I put in the directory. Since it is complaining about the manifest not matching, I’m trying to find a reference in my project for that version and public key, but I am coming up short. It seems this manifest is created at compile time.
How can I override that? is there a property or switch or conditional compilation I can use to specify exactly which assembly I wish to reference?
Ultimately I want to use the 1.2.11 version of log4net, and force the assembly to ignore the version in the GAC, to look only in the local bin directory. This really shouldn’t be this painful.
Runtime Directive
At runtime, you can use
AppDomain.AssemblyResolveto combat the assembly versioning issue when you don’t care what specific version is present, you just want to load what’s in the/binfolder. This code was created with inspiration from here.An alternative to handling the
AssemblyResolveevent would be to use a custombindingRedirectpolicy. However – this only works if you know what version is present in the/binor currently loaded in the App Domain.Build-Time Directive
If you want control of which assembly version is used at build-time, you can use the
Specific Version='true'for assembly references you add.