从的NuGet System.Data.SQLite,互操作DLL不会被复制到输出目录 [英] System.Data.SQLite from NuGet, interop dll not copied to output directory
问题描述
我从安装的NuGet System.Data.SQLite核心(在x86 / x64) 。它没有内置警告,但扔 System.DllNotFoundException
关于 SQLite.Interop.dll
。我操纵我的项目复制 SQLite.Interop.dll
从的NuGet包的目录,到输出目录下,而现在它在运行时异常。
I installed System.Data.SQLite Core (x86/x64) from NuGet. It built without warnings but threw System.DllNotFoundException
regarding SQLite.Interop.dll
. I rigged my projects to copy the SQLite.Interop.dll
from under the NuGet package's directory to the output directory, and now it runs without the exception.
为什么没有的NuGet包配置我的项目,把合适的互操作的dll在输出目录?现在看来似乎应该是能够做到这一点。
Why didn't the NuGet package configure my projects to put the appropriate interop dll in the output directory? It seems like it should be able to do that.
我新的互操作,我继承了这个代码库,而此前引用 System.Data这.SQLite.dll
按路径直接。我切换到的NuGet摆脱警告约VS System.Data.SQLite
项目的处理器架构之间的不匹配。我试图建立所有项目的值为anycpu。
I'm new to interop and I inherited this codebase, which previously referenced System.Data.SQLite.dll
directly by path. I switched to NuGet to get rid of warnings about a mismatch between the processor architecture of the project vs System.Data.SQLite
. I'm trying to build all projects as AnyCPU.
推荐答案
我认为这是发生在,因为我是从复制文件我的输出文件夹到另一个位置,当我部署它们。我错过了一个事实,即互操作性文件已被复制,但他们是你的输出文件夹中复制到x64和x86文件夹。
I thought this was happening to, as I was copying the files from my output folder to another location when I deployed them. I missed the fact that the interop files WERE being copied, but they are copied to x64 and x86 folders within your output folder.
如果您的项目在调试的MSBuild,你可以看看,以确保到 CopySQLiteInteropFiles
目标引用它正在运行。
If you run msbuild in debug on the project, you can look for references to the CopySQLiteInteropFiles
target to ensure that it is running.
这篇关于从的NuGet System.Data.SQLite,互操作DLL不会被复制到输出目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!