FosAvance
FosAvance

Reputation: 2469

Include x32 or x64 System.Data.SQLite.dll file correctly

I was searching on internet about it but I'm not sure exactly what to do. I found out that I need to include some code in my Program.csproj file.

When I open Program.csproj it says

<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <ProjectView>ShowAllFiles</ProjectView>
  </PropertyGroup>

</Project>

this is code which I need to include:

<Reference 
       Include="System, Version=1.0.66.0, Culture=neutral, processorArchitecture=MSIL"  
         Condition=" '$(Platform)' == 'AnyCPU' ">
      <SpecificVersion>False</SpecificVersion>
      <HintPath>library\sqlite\x32\System.Data.SQLite.dll</HintPath>
      <Private>False</Private>
    </Reference>
    <Reference 
         Include="System, Version=1.0.66.0, processorArchitecture=MSIL" 
         Condition=" '$(Platform)' == 'x64' ">
      <SpecificVersion>False</SpecificVersion>
      <HintPath>library\sqlite\x64\System.Data.SQLite.DLL</HintPath>
</Reference>

But I'm not quite sure if this is correct cause my program is taking all dll from it's root directory and not from "library\sqlite\" Could someone please help me to do it correctly? I just can't get it right

Upvotes: 4

Views: 9510

Answers (1)

Salaros
Salaros

Reputation: 1456

First of all I strongly recommend you to use v1.0.67+ from http://system.data.sqlite.org

http://system.data.sqlite.org/blobs/1.0.83.0/sqlite-netFx40-binary-Win32-2010-1.0.83.0.zip
http://system.data.sqlite.org/blobs/1.0.83.0/sqlite-netFx40-binary-x64-2010-1.0.83.0.zip

So just extract AnyCPU files from one of two archives (both contain the same version):

System.Data.SQLite.dll
System.Data.SQLite.Linq.dll

While x64 and x86 files (SQLite.Interop.dll) must be copied as follows. On 32-bit operating system

  • file from from sqlite-netFx40-binary-Win32-2010-1.0.xx.0.zip goes in C:\Windows\system32

On 64-bit operating system

  • x64 files goes in C:\Windows\system32
  • Win32 goes in C:\Windows\SysWOW64

.NET will automatically "choose" the right Interop file to include

Upvotes: 3

Related Questions