无法在目标机器上加载文件或程序集 system.data.sqlite [英] could not load file or assembly system.data.sqlite on target machine

查看:27
本文介绍了无法在目标机器上加载文件或程序集 system.data.sqlite的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I've a windows form, connected to a sqlite db.
The application is running fine on my pc, but when I run it on any other pc I get the Message:

    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 更改为:

I've tried to change App.xml to:

    <?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 的情况下运行我的应用程序?

The target machine has .NET 4.5 installed, and the problem isn't about .NET because the message only appears on classes that use sqlite.
I've tried to install Visual C++ 2010 SP1 Redistributable x86 but that didn't solve the problem.
But when I Installed Visual Studio, it worked like charm.
How should I run my application without installing Visual Studio on client machine?

推荐答案

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

The SQLite .NET assemblies are not part of the .NET Framework or Visual C++ 2010 SP1 Redistributable x86; you should deploy them with your application.

来自 System.Data.SQLite 常见问题解答:

推荐的程序集部署方式是应用程序本地"(即,将它们复制到安装应用程序的目录中)

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

也不要忘记本机互操作 DLL;你基本上需要像这样部署:

Also don't forget the native interop DLLs; you basically need to deploy like this:

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

这篇关于无法在目标机器上加载文件或程序集 system.data.sqlite的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆