.NET Framework 專案 - 通過 Nuget 包將 SQLite 添加到我的專案中,app.config 和 package.config 看起來正確。
錯誤是:-“型別:System.IO.FileNotFoundException,mscorlib,Version=4.0.0.0,Culture=neutral,PublicKeyToken=b77a5c561934e089 訊息:無法加載檔案或程式集'System.Data.SQLite,Version=1.0.115.5,Culture =neutral, PublicKeyToken=db937bc2d44ff139 ' 或其依賴項之一。系統找不到指定的檔案。”
所有針對 x86 的專案
包.config
<packages>
<package id="EntityFramework" version="6.4.4" targetFramework="net471" />
<package id="Stub.System.Data.SQLite.Core.NetFramework" version="1.0.115.5" targetFramework="net471" />
<package id="System.Data.SQLite" version="1.0.115.5" targetFramework="net471" />
<package id="System.Data.SQLite.Core" version="1.0.115.5" targetFramework="net471" />
<package id="System.Data.SQLite.EF6" version="1.0.115.5" targetFramework="net471" />
<package id="System.Data.SQLite.Linq" version="1.0.115.5" targetFramework="net471" />
</packages>
我已經嘗試過下面的鏈接和許多其他鏈接,但沒有任何效果 - 我錯過了什么?

uj5u.com熱心網友回復:
我最近從 1.0.113 升級到 1.0.115 時遇到了類似的問題。似乎不再正確復制依賴的本機二進制檔案。
將這兩行添加到專案的構建后步驟(與您的解決方案中的哪一行無關)有幫助:
xcopy /s /y "%USERPROFILE%\.nuget\packages\Microsoft.SqlServer.Compact\4.0.8876.1\NativeBinaries\amd64\*.*" "$(TargetDir)"
xcopy /s /y "%USERPROFILE%\.nuget\packages\Stub.System.Data.SQLite.Core.NetFramework\1.0.115\build\net46\*.dll" "$(TargetDir)"
(也許您需要調整行,具體取決于所使用的包版本和目標 .NET 版本)
編輯 由于您仍在使用packages.config,上面的復制說明可能應該更改為:
xcopy /s /y "$(SolutionDir)\packages\Microsoft.SqlServer.Compact\4.0.8876.1\NativeBinaries\amd64\*.*" "$(TargetDir)"
xcopy /s /y "$(SolutionDir)\packages\Stub.System.Data.SQLite.Core.NetFramework\1.0.115\build\net46\*.dll" "$(TargetDir)"
轉載請註明出處,本文鏈接:https://www.uj5u.com/net/363307.html
標籤:sqlite 例外 组件 系统数据.sqlite .net-framework-4.8
