You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

.NET Framework项目引用System.Data.SQLite 1.0.115.5提示无法加载程序集如何解决

.NET Framework 加载System.Data.SQLite 1.0.115.5报错解决方案
  • 检查程序集引用属性
    打开项目引用列表,找到System.Data.SQLite相关引用,确认引用路径指向当前解决方案packages目录下的1.0.115.5版本对应dll,同时将引用属性中的复制本地设置为True,避免引用GAC中其他版本的程序集导致冲突。
  • 安装对应版本VC运行库
    System.Data.SQLite依赖VC
    2015-2019可再发行组件,因项目目标平台为x86,必须安装x86版本的对应运行库,缺少运行库会触发文件找不到的异常,而非实际缺少SQLite程序集。
  • 确认app.config程序集重定向配置正确
    检查app.config中runtime节点下是否存在匹配版本的绑定重定向规则,示例配置如下:
    <configuration>
      <runtime>
        <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
          <dependentAssembly>
            <assemblyIdentity name="System.Data.SQLite" publicKeyToken="db937bc2d44ff139" culture="neutral" />
            <bindingRedirect oldVersion="0.0.0.0-1.0.115.5" newVersion="1.0.115.5" />
          </dependentAssembly>
          <dependentAssembly>
            <assemblyIdentity name="System.Data.SQLite.Core" publicKeyToken="db937bc2d44ff139" culture="neutral" />
            <bindingRedirect oldVersion="0.0.0.0-1.0.115.5" newVersion="1.0.115.5" />
          </dependentAssembly>
        </assemblyBinding>
      </runtime>
    </configuration>
    
  • 确认SQLite.Interop.dll已复制到输出目录
    编译完成后检查输出目录(bin\x86\Debug或Release),除了System.Data.SQLite.dll、System.Data.SQLite.Core.dll外,需要存在对应x86架构的SQLite.Interop.dll。如果缺失可以添加生成后事件自动复制:
    xcopy "$(SolutionDir)packages\System.Data.SQLite.Core.1.0.115.5\build\net471\x86\SQLite.Interop.dll" "$(TargetDir)" /y
  • 主启动项目显式安装SQLite Nuget包
    如果SQLite是安装在类库项目中,主启动项目也需要单独安装对应版本的System.Data.SQLite Nuget包,否则依赖文件不会自动复制到主项目的输出目录。
  • 清理编译缓存后重新生成
    手动删除解决方案下所有项目的bin、obj文件夹,再执行重新生成操作,避免旧编译缓存导致的引用异常。

内容的提问来源于stack exchange,提问作者Ram

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.09.25 19:06:02