title: MVC3 app - getting "Could not load file or assembly 'System.Data.SQLite' or one of its dependencies."
body: <p><strong>The problem:</strong></p>
  
  <p>I'm building a c# 4.0, MVC 3 based web app. I'm using SQLite as a database.</p>
  
  <p>When I start the app, I get this error:</p>
  
  <p>Could not load file or assembly 'System.Data.SQLite' or one of its dependencies. An attempt was made to load a program with an incorrect format.</p>
  
  <p>This is the fusion assembly load trace:</p>
  
  <pre><code>=== Pre-bind state information ===
  LOG: User = Steve-PC\Steve
  LOG: DisplayName = System.Data.SQLite
   (Partial)
  WRN: Partial binding information was supplied for an assembly:
  WRN: Assembly Name: System.Data.SQLite | Domain ID: 2
  WRN: A partial bind occurs when only part of the assembly display name is provided.
  WRN: This might result in the binder loading an incorrect assembly.
  WRN: It is recommended to provide a fully specified textual identity for the assembly,
  WRN: that consists of the simple name, version, culture, and public key token.
  WRN: See whitepaper http://go.microsoft.com/fwlink/?LinkId=109270 for more information and common solutions to this issue.
  LOG: Appbase = file:///C:/Users/Steve/Documents/Visual Studio 2010/Projects/EMMA3/EMMA_Web/
  LOG: Initial PrivatePath = C:\Users\Steve\Documents\Visual Studio 2010\Projects\EMMA3\EMMA_Web\bin
  Calling assembly : (Unknown).
  ===
  LOG: This bind starts in default load context.
  LOG: Using application configuration file: C:\Users\Steve\Documents\Visual Studio 2010\Projects\EMMA3\EMMA_Web\web.config
  LOG: Using host configuration file: C:\Users\Steve\Documents\IISExpress\config\aspnet.config
  LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
  LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
  LOG: Attempting download of new URL file:///C:/Users/Steve/AppData/Local/Temp/Temporary ASP.NET Files/root/6454c2d1/d37faccb/System.Data.SQLite.DLL.
  LOG: Attempting download of new URL file:///C:/Users/Steve/AppData/Local/Temp/Temporary ASP.NET     Files/root/6454c2d1/d37faccb/System.Data.SQLite/System.Data.SQLite.DLL.
  LOG: Attempting download of new URL file:///C:/Users/Steve/Documents/Visual Studio 2010/Projects/EMMA3/EMMA_Web/bin/System.Data.SQLite.DLL.
  ERR: Failed to complete setup of assembly (hr = 0x8007000b). Probing terminated.
  </code></pre>
  
  <p><strong>I am using:</strong></p>
  
  <p>Windows 7 x64
  Visual Web Developer 2010
  IIS Express 7.5
  System.Data.SQLite x64 1.0.77.0</p>
  
  <p>I've Googled around a lot and the general thought seems to be that this is related to running a 32 bit assembly on a 64 bit system or vice versa.</p>
  
  <p><strong>Things I've tried:</strong></p>
  
  <ol>
  <li>Switch to IIS Express from the VS built in web server. Apparently the built in server can only cope with 32bit applications and IIS Express can do both. No change.</li>
  <li>Make sure you're using the 64 bit version of SQLite. Originally, I was using the regular version but changing to the 64 bit version does not seem to help.</li>
  <li>Enable the '32 bit app on win 64' setting in IIS. (In IIS express, this is done using appcmd.exe - appcmd set apppool /apppool.name: "" /enable32bitapponwin64:true). Again, this made no change.</li>
  <li>Uninstall/reinstall Sqlite. No change.</li>
  <li>Create a simpler version of the project to make sure everything is clean and narrow down the cause. This lead me to the 'steps to reproduce' below but hasn't really helped me.</li>
  </ol>
  
  <p><strong>Steps to reproduce:</strong></p>
  
  <ol>
  <li>Create new MVC 3 web project.</li>
  <li>Run it and see that it works.</li>
  <li>Use Nuget to add a reference to SQLite x64.</li>
  <li>Run site again and it will give this error.</li>
  </ol>
  
  <p>So in summary - I'm getting the error above, it's definitely due in some way to SQLite, I seem to have everything 64 bit, but it still doesn't work. Any ideas?</p>
  
  <p>Thanks in advance.</p>