gpt4 book ai didi

c# - 无法在目标机器上加载文件或程序集 system.data.sqlite

转载 作者:太空宇宙 更新时间:2023-11-03 13:00:02 25 4
gpt4 key购买 nike

我有一个 Windows 窗体,连接到一个 sqlite 数据库。
该应用程序在我的电脑上运行良好,但是当我在任何其他电脑上运行它时,我收到消息:

    could not load file or assembly 'system.data.sqlite, version=1.0.84.0. culture=neutral, publickey token=db937bc2d44ff139' or one of irs dependencies

我尝试将 App.xml 更改为:

    <?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0" />
</startup>
</configuration>

目标机器安装了 .NET 4.5,问题与 .NET 无关,因为该消息仅出现在使用 sqlite 的类上。
我已尝试安装 Visual C++ 2010 SP1 Redistributable x86,但这并没有解决问题。
但是当我安装 Visual Studio 时,它就像魅力一样工作。
我应该如何在客户端计算机上不安装 Visual Studio 的情况下运行我的应用程序?

最佳答案

SQLite .NET 程序集不是 .NET Framework 或 Visual C++ 2010 SP1 Redistributable x86 的一部分;您应该将它们与您的应用程序一起部署。

来自System.Data.SQLite FAQ :

The recommended way to deploy the assemblies is "application local" (i.e. copy them to the directory the application is installed to)

另外不要忘记 native 互操作 DLL;你基本上需要这样部署:

- YourApp.exe
- System.Data.SQLite.dll
- x86/SQLite.Interop.dll
- x64/SQLite.Interop.dll

关于c# - 无法在目标机器上加载文件或程序集 system.data.sqlite,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32602139/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com