SAP Knowledge Base Article - Public

1550854 - "Could not load file or assembly 'log4net' or one of its dependencies" Error when building Visual Studio 2010 solution utilizing the Crystal Reports .NET Runtime


  • Error when building a project or solution in Visual Studio 2010.
  • Error: Could not load file or assembly 'log4net' or one of its dependencies. An attempt was made to load a program with an incorrect format.



  • Visual Studio 2010
  • Crystal Reports for Visual Studio 2010, RTM

Reproducing the Issue

  • Set the Platform target for the class library or web application to Any CPU.
  • Create a Web Deployment Project from your web application.
  • Create a Web Setup Project and add the Web Deployment Project as your Project Output.
  • Build the entire solution.


  • The 64 bit version of log4net.dll is being copied into your web site or web application bin directory.
  • The Visual Studio IDE is building the other project files as 32 bit and the 64 bit log4net causes the error to be thrown.


  1. Copy the 32 bit version of log4net.dll to the directory below. A copy of log4net 32 bit is attached to this article.
    1. C:\Program Files (x86)\SAP BusinessObjects\Crystal Reports for .NET Framework 4.0\Common\SAP BusinessObjects Enterprise XI 4.0\win32_x86\dotnet
  2. Clean your solution and delete any copy of log4net.dll from the bin directory in your project.
  3. Build your solution.


KBA , BI-DEV-NET , BI Software Development Kits (SDKs) - .NET or Other , Bug Filed


SAP Crystal Reports, developer version for Microsoft Visual Studio