将vs2015 .net标准升级到vs2017时,我在测试项目中遇到以下错误。
无法加载DLL的'sqlite3':找不到指定的模块。 (HRESULT异常:0x8007007E)
适用于vs2015,sqlite provider 1.0.101.0
新环境:Visual Studio 2017,TargetFramework =“net461”使用.netcore1.1软件包,sqlite提供程序1.0.105.0
我已经尝试了以下可以从互联网上获得的所有决议,但都是徒劳的。我试过了,
<GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType><AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
已安装的提供商:sqlite-netFx46-static-binary-bundle-Win32-2015-1.0.105.0.zip来自http://system.data.sqlite.org
已安装System.Data.SQLite 1.0.105 nuget package
尝试加载格式不正确的程序。 (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
一切都没有用。 我错过了什么?
答案 0 :(得分:4)
通过步行解决。
我在visual studio 2017中尝试过POC,有一个net461项目和一个单元测试项目,net461项目适用于sqlite,但单元测试项目需要引用sqlite package,
然而,sqlite包与net461类库项目不兼容,没有dll被提升到bin / x86或bin / x64文件夹
随附的是将x86 / sqlite3.dll,x64 / sqlite3.dll添加到项目中作为“内容”和“复制它更新”(否则,它可能被使用,并导致错误),如下所示
System.Data.SQLite,这里不需要。
现在它有效。希望sqlite包将很快与visual studio 2017兼容