"Unable to load DLL 'SQLite.Interop.dll' error on client machine

放肆的年华 提交于 2019-12-11 11:50:53

问题


I have created a Winforms application and am using SQLite with Entity Framework 6. I am using Visual Studio 2013.

The application works perfectly on my local machine. However, when the program runs on another machine the following error occurs:

"Unable to load DLL 'SQLite.Interop.dll': The specified module could not be found.

As far as I'm concerned, the problem is that the Interop dll isn't being copied to the directory when I publish my project.

My question is: How do I force this dll to copy to the correct directory when I publish the application?


回答1:


I found a workaround for my issue. I already had correctly installed all of the SQLite packages, yet the Interop.dlls were not copying over when I published the application.

What I did was build the project, and then went into the bin/Debug/ folders and copied the x86 and x64 folders that contained the SQLite.Interop.dll files. I then included those folders in my project. All if working fine now.




回答2:


For posterity, if you added SQLite via NuGet and it's not copying you can add this into your csproj file and it should copy the x86 and the x64:

 <PropertyGroup> 
    <ContentSQLiteInteropFiles>true</ContentSQLiteInteropFiles>
    <CopySQLiteInteropFiles>false</CopySQLiteInteropFiles>
    <CleanSQLiteInteropFiles>false</CleanSQLiteInteropFiles>
    <CollectSQLiteInteropFiles>false</CollectSQLiteInteropFiles>
 </PropertyGroup>



回答3:


In Visual Studio set the SQLite.Interop.dll reference property "Copy Local" to true.



来源:https://stackoverflow.com/questions/31778425/unable-to-load-dll-sqlite-interop-dll-error-on-client-machine

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!