SmartAssembly 6

SmartAssembly MSBUILD tasks failing because of difference in log4net assembly

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=, 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)


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 as a console application from MSBUILD.

If you continue to experience problems, please contact Redgate support.

Didn't find what you were looking for?