Visual Studio 2017更新问题:无法加载DLL‘sqlite3’:找不到指定的模块。 (HRESULT 异常:0x8007007E)
Visual Studio 2017 update issue: Unable to load DLL ‘sqlite3’: The specified module could not be found. (Exception from HRESULT: 0x8007007E)
在将 vs2015 .net standard 升级到 vs2017 时,我在测试项目中遇到以下错误。
Unable to load DLL ‘sqlite3’: The specified module could not be found.
(Exception from 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
已安装的提供程序:sqlite-netFx46-static-binary-bundle-Win32-2015-1.0.105.0.zip 来自 http://system.data.sqlite.org
已安装System.Data.SQLite 1.0.105 nuget 包
- 尝试将 sqlite3.dll (x86) 放入项目文件夹,将其设置为 "Content" 和 "copy always",甚至尝试将文件复制到 bin/x86/,它抱怨新错误
An attempt was made to load a program with an incorrect format.
(Exception from 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"
的扩展
一切都无济于事。
我错过了什么吗?
通过绕行解决。
我在visual studio2017年尝试过POC,有一个net461项目和一个单元测试项目,net461项目与sqlite配合得很好,但单元测试项目需要参考sqlite package,
然而,sqlite 包不能很好地与 net461 class 库项目一起工作,没有 dll 被提取到 bin/x86 或 bin/x64 文件夹
解决方法是将 x86/sqlite3.dll、x64/sqlite3.dll 添加到项目中作为 "Content" 和 "Copy it Newer"(否则,它可能会被使用,并且导致错误)如下
System.Data.SQLite,这里真的不需要。
现在可以了。希望 sqlite 包能尽快与 visual studio 2017
兼容
在将 vs2015 .net standard 升级到 vs2017 时,我在测试项目中遇到以下错误。
Unable to load DLL ‘sqlite3’: The specified module could not be found. (Exception from 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
已安装的提供程序:sqlite-netFx46-static-binary-bundle-Win32-2015-1.0.105.0.zip 来自 http://system.data.sqlite.org
已安装System.Data.SQLite 1.0.105 nuget 包
- 尝试将 sqlite3.dll (x86) 放入项目文件夹,将其设置为 "Content" 和 "copy always",甚至尝试将文件复制到 bin/x86/,它抱怨新错误
An attempt was made to load a program with an incorrect format. (Exception from 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" 的扩展
一切都无济于事。 我错过了什么吗?
通过绕行解决。
我在visual studio2017年尝试过POC,有一个net461项目和一个单元测试项目,net461项目与sqlite配合得很好,但单元测试项目需要参考sqlite package,
然而,sqlite 包不能很好地与 net461 class 库项目一起工作,没有 dll 被提取到 bin/x86 或 bin/x64 文件夹
解决方法是将 x86/sqlite3.dll、x64/sqlite3.dll 添加到项目中作为 "Content" 和 "Copy it Newer"(否则,它可能会被使用,并且导致错误)如下
System.Data.SQLite,这里真的不需要。
现在可以了。希望 sqlite 包能尽快与 visual studio 2017
兼容