SmartAssembly MSBUILD tasks failing because of difference in log4net assembly
Published 08 March 2019
This article only applies to SmartAssembly 6 and earlier. The problem was fixed in SmartAssembly 7.
When building a Visual Studio project using SmartAssembly's MSBUILD integration, the following error may appear in the output window and the build will fail:
Could not load file or assembly 'log4net, Version=1.2.11.0, Culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
Cause
This issue has arisen because a common third-party logging component called Log4Net has changed their public key. For this reason, SmartAssembly cannot load log4net into Visual Studio's process if log4net has already been loaded with a different public key.
How to fix
The current workarounds, until all Visual Studio components have updated their log4net assembly, are to either remove the conflicting add-in from Visual Studio or to switch SmartAssembly from using the MSBUILD component to using an EXEC task that runs SmartAssembly.com as a console application from MSBUILD.
If you continue to experience problems, please contact Redgate support.