title: Could not load file or assembly 'System.Data.SQLite'
body: <p>I've installed ELMAH 1.1 .Net 3.5 x64 in my ASP.NET project and now I'm getting this error (whenever I try to see any page):</p>
  
  <blockquote>
    <p>Could not load file or assembly
    'System.Data.SQLite, Version=1.0.61.0,
    Culture=neutral,
    PublicKeyToken=db937bc2d44ff139' or
    one of its dependencies. An attempt
    was made to load a program with an
    incorrect format.</p>
    
    <p>Description: An
    unhandled exception occurred during
    the execution of the current web
    request. Please review the stack trace
    for more information about the error
    and where it originated in the code.</p>
    
    <p>Exception Details:
    System.BadImageFormatException: Could
    not load file or assembly
    'System.Data.SQLite, Version=1.0.61.0,
    Culture=neutral,
    PublicKeyToken=db937bc2d44ff139' or
    one of its dependencies. An attempt
    was made to load a program with an
    incorrect format.</p>
  </blockquote>
  
  <p>More error details at the bottom.</p>
  
  <p>My Active Solution platform is "Any CPU" and I'm running on a x64 Windows 7 on an x64, of course, processor. The reason why we are using this version of ELMAH is because 1.0 .Net 3.5 (x86, which is the only platform for which it's compiled) gave us this same error on our x64 Windows server.</p>
  
  <p>I've tried compiling for x86 and x64 and I get the same error. I've tried removing the all compiler output (bin and obj). Finally I've made a reference to the SQLite dll directly, something that was not needed for the project to work on the server and I've got this compiler error:</p>
  
  <blockquote>
    <p>Error 1 Warning as Error: Assembly generation -- Referenced assembly 'System.Data.SQLite.dll' targets a different processor MyProject</p>
  </blockquote>
  
  <p>Any ideas what the problem might be?</p>
  
  <p>More error details:</p>
  
  <blockquote>
    <p>Source Error:</p>
    
    <p>An unhandled exception was generated
    during the execution of the current
    web request. Information regarding the
    origin and location of the exception
    can be identified using the exception
    stack trace below.</p>
    
    <p>Stack Trace:</p>
    
    <p>[BadImageFormatException: Could not
    load file or assembly
    'System.Data.SQLite, Version=1.0.61.0,
    Culture=neutral,
    PublicKeyToken=db937bc2d44ff139' or
    one of its dependencies. An attempt
    was made to load a program with an
    incorrect format.]<br>
    System.Reflection.Assembly._nLoad(AssemblyName
    fileName, String codeBase, Evidence
    assemblySecurity, Assembly
    locationHint, StackCrawlMark&amp;
    stackMark, Boolean
    throwOnFileNotFound, Boolean
    forIntrospection) +0<br>
    System.Reflection.Assembly.nLoad(AssemblyName
    fileName, String codeBase, Evidence
    assemblySecurity, Assembly
    locationHint, StackCrawlMark&amp;
    stackMark, Boolean
    throwOnFileNotFound, Boolean
    forIntrospection) +43<br>
    System.Reflection.Assembly.InternalLoad(AssemblyName
    assemblyRef, Evidence
    assemblySecurity, StackCrawlMark&amp;
    stackMark, Boolean forIntrospection)
    +127    System.Reflection.Assembly.InternalLoad(String
    assemblyString, Evidence
    assemblySecurity, StackCrawlMark&amp;
    stackMark, Boolean forIntrospection)
    +142    System.Reflection.Assembly.Load(String
    assemblyString) +28<br>
    System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String
    assemblyName, Boolean starDirective)
    +46</p>
    
    <p>[ConfigurationErrorsException: Could
    not load file or assembly
    'System.Data.SQLite, Version=1.0.61.0,
    Culture=neutral,
    PublicKeyToken=db937bc2d44ff139' or
    one of its dependencies. An attempt
    was made to load a program with an
    incorrect format.]<br>
    System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String
    assemblyName, Boolean starDirective)
    +613    System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory()
    +203    System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo
    ai) +105<br>
    System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection
    compConfig) +178<br>
    System.Web.Compilation.BuildProvidersCompiler..ctor(VirtualPath
    configPath, Boolean
    supportLocalization, String
    outputAssemblyName) +54<br>
    System.Web.Compilation.ApplicationBuildProvider.GetGlobalAsaxBuildResult(Boolean
    isPrecompiledApp) +232<br>
    System.Web.Compilation.BuildManager.CompileGlobalAsax()
    +52    System.Web.Compilation.BuildManager.EnsureTopLevelFilesCompiled()
    +337</p>
    
    <p>[HttpException (0x80004005): Could not
    load file or assembly
    'System.Data.SQLite, Version=1.0.61.0,
    Culture=neutral,
    PublicKeyToken=db937bc2d44ff139' or
    one of its dependencies. An attempt
    was made to load a program with an
    incorrect format.]<br>
    System.Web.Compilation.BuildManager.ReportTopLevelCompilationException()
    +58    System.Web.Compilation.BuildManager.EnsureTopLevelFilesCompiled()
    +512    System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager
    appManager, IApplicationHost appHost,
    IConfigMapPathFactory
    configMapPathFactory,
    HostingEnvironmentParameters
    hostingParameters) +729</p>
    
    <p>[HttpException (0x80004005): Could not
    load file or assembly
    'System.Data.SQLite, Version=1.0.61.0,
    Culture=neutral,
    PublicKeyToken=db937bc2d44ff139' or
    one of its dependencies. An attempt
    was made to load a program with an
    incorrect format.]<br>
    System.Web.HttpRuntime.FirstRequestInit(HttpContext
    context) +8896783<br>
    System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext
    context) +85<br>
    System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest
    wr) +259</p>
  </blockquote>