SAP Knowledge Base Article - Public

1543854 - Error: Could not load file or assembly log4net


  • Web site uses a Visual Studio 2010 Web Deployment project and web setup project to compile the MSI
  • Deploying the runtime to Windows Server 2008 R2 (32 or 64 bit) results in the 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
  • Windows Server 2008 R2



  • Windows Application
    • In the Project Properties and select the Publish tab
    • Click the Application Files button
    • Exclude any CrystalDecisions or BusinessObjects assemblies present in the list
    • Exclude the log4net.dll
    • Re-build and re-publish the application
  • Web Application
    • In the Web setup project right-click Primary Output
    • Add “log4net.dll” and save the dialog
    • Re-build the project and re-deploy


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


SAP Crystal Reports, developer version for Microsoft Visual Studio