正确地包含x32或x64的System.Data.SQLite.dll文件

4

我在互联网上搜索了一些关于IT技术的内容,但我不确定具体该怎么做。

我发现我需要在我的Program.csproj文件中包含一些代码。

当我打开Program.csproj文件时,它显示:

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

</Project>

以下是我需要包含的代码:

<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>

但我不确定这是否正确,因为我的程序从根目录中获取所有dll文件,而不是从“library\sqlite\”中获取。

有人可以帮我正确地做吗?我就是搞不对。

1个回答

3

首先,我强烈建议您使用来自http://system.data.sqlite.org的v1.0.67+版本。

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

所以只需从两个存档中的任一个提取AnyCPU文件(两个存档都包含相同版本):

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

在32位操作系统中,必须按以下方式复制x64和x86文件(SQLite.Interop.dll)。

  • 来自sqlite-netFx40-binary-Win32-2010-1.0.xx.0.zip的文件应放在C:\ Windows \ system32中。

在64位操作系统中:

  • x64文件放在C:\Windows\system32中。
  • Win32文件放在C:\Windows\SysWOW64中。

.NET将自动“选择”要包含的正确Interop文件。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接