After installing a package that uses a newer version of Log4net, Umbraco fails to start and you get the yellow screen of death.
Steps to recreate
- With a working copy of Umbraco 7.2.x install a NuGet package that requires Log4net 2.0.3 such as Google.Apis.Customsearch.v1
- Following installation of the package build and run site
- Site fails with error: "Could not load file or assembly 'log4net, Version=18.104.22.168, Culture=neutral, PublicKeyToken=null' or one of its dependencies."
Steps to correct
Download 7.2.5 zip and extract the log4net dll
- Rename the dll to log4net.22.214.171.124.dll
- Place it in a folder in your solution, mine is named Dependencies
- Include in project
- Go to dll properties
- Set build action to "None"
- Set Copy to Output Directory to "Copy if newer"
add the following to the web.config, be sure to reference the bin directory as that's were your new folder will be copied at build time.
<assemblyBinding> <dependentAssembly> <assemblyIdentity name="log4net" /> <codeBase version="126.96.36.199" href="bin/Dependencies/log4net.188.8.131.52.dll" /> </dependentAssembly> </assemblyBinding>
Build the solution, and run, your site should now be back to normal.
This enables Umbraco to use it's preferred version of Log4net (184.108.40.206) whilst your other packages use Log4net 2.0.3.