在将vs2015 .net标准升级到vs2017时,我在测试项目中遇到了以下错误。
无法加载DLL“sqlite3”:找不到指定的模块。 (HRESULT异常:0x8007007E)
在vs2015中以及使用sqlite提供程序1.0.101.0时它工作良好。
新环境: Visual Studio 2017, TargetFramework="net461",使用.netcore1.1包和sqlite提供程序1.0.105.0
我已经尝试了从互联网上获取的所有解决方案,如下所示,但都徒劳无功。我已经尝试了:
- 将以下内容添加到.csproj文件中:
<GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType><AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
- 将测试处理器选择为x86
从http://system.data.sqlite.org安装提供程序:sqlite-netFx46-static-binary-bundle-Win32-2015-1.0.105.0.zip
安装System.Data.SQLite 1.0.105 nuget包
- 尝试将sqlite3.dll(x86)放置在项目文件夹中,并将其设置为“内容”和“始终复制”,甚至尝试将该文件复制到bin / x86 /,但仍然出现新的错误
尝试加载具有不正确格式的程序时出错。(HRESULT异常:0x8007000B)
at Microsoft.Data.Sqlite.Interop.NativeMethods.Sqlite3_sqlite3.sqlite3_open_v2(IntPtr filename, Sqlite3Handle& ppDb, Int32 flags, IntPtr vfs)
at Microsoft.Data.Sqlite.Interop.NativeMethods.Sqlite3_sqlite3.open_v2(IntPtr filename, Sqlite3Handle& ppDb, Int32 flags, IntPtr vfs)
at Microsoft.Data.Sqlite.Interop.NativeMethods.sqlite3_open_v2(String filename, Sqlite3Handle& ppDb, Int32 flags, String vfs)
at Microsoft.Data.Sqlite.SqliteConnection.Open()
at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.Open()
at Microsoft.EntityFrameworkCore.Storage.Internal.SqliteRelationalConnection.Open()
at Microsoft.EntityFrameworkCore.Query.Internal.QueryingEnumerable.Enumerator.BufferlessMoveNext(Boolean buffer)
at Microsoft.EntityFrameworkCore.Storage.Internal.NoopExecutionStrategy.Execute[TState,TResult](Func`2 operation, Func`2 verifySucceeded, TState state)
at Microsoft.EntityFrameworkCore.ExecutionStrategyExtensions.Execute[TState,TResult](IExecutionStrategy strategy, Func`2 operation, TState state)
at Microsoft.EntityFrameworkCore.Query.Internal.QueryingEnumerable.Enumerator.MoveNext()
at Microsoft.EntityFrameworkCore.Query.QueryMethodProvider.<_ShapedQuery>d__3`1.MoveNext()
at Microsoft.EntityFrameworkCore.Query.QueryMethodProvider.<_Include>d__30`1.MoveNext()
at Microsoft.EntityFrameworkCore.Query.QueryMethodProvider.<_Include>d__30`1.MoveNext()
at Microsoft.EntityFrameworkCore.Query.Internal.LinqOperatorProvider.<_TrackEntities>d__15`2.MoveNext()
at Microsoft.EntityFrameworkCore.Query.Internal.LinqOperatorProvider.ExceptionInterceptor`1.EnumeratorExceptionInterceptor.MoveNext()
at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
at
- 下载了2017年的C++运行库
- 安装了“SQLite runtime for windows”扩展
这些都没有帮助吗?我有遗漏什么吗?