SQLite.Interop.dll files does not copy to project

2019-02-12 14:55发布

I am using the System.Data.SQLite Core Version: 1.0.98.1 nuget package with Visual Studio 2015. When I build my project that references my System.Data.SQLite package, it copies two folders (x86 and x64) each containing a SQLite.Interop.dll to the output directory. However when I build my test project or any other project that references the previously mentioned project, these folders do not get copied to the the parent project's output directory, and I get a DllNotFoundException on the SQLite.Interop.dll.

Note: this is specifically when the project referencing System.Data.SQLite is referenced by another project

1条回答
萌系小妹纸
2楼-- · 2019-02-12 15:26

The recomended solution as doumented here is to create a System.Data.SQLite.Core.targets.user in your packages\System.Data.SQLite.Core.1.0.98.1\build\[your framework version here] folder containing

<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    <PropertyGroup> 
        <ContentSQLiteInteropFiles>true</ContentSQLiteInteropFiles>
        <CopySQLiteInteropFiles>false</CopySQLiteInteropFiles>
        <CleanSQLiteInteropFiles>false</CleanSQLiteInteropFiles>
        <CollectSQLiteInteropFiles>false</CollectSQLiteInteropFiles>
    </PropertyGroup>
</Project>

But if you don't want to add anything in your packages folder to your source control, you can just add the following directly to your project file

<PropertyGroup> 
    <ContentSQLiteInteropFiles>true</ContentSQLiteInteropFiles>
    <CopySQLiteInteropFiles>false</CopySQLiteInteropFiles>
    <CleanSQLiteInteropFiles>false</CleanSQLiteInteropFiles>
    <CollectSQLiteInteropFiles>false</CollectSQLiteInteropFiles>
</PropertyGroup>
查看更多
登录 后发表回答