Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in Visual Studio 2017 - Unable to load DLL 'e_sqlite3': The specified module could not be found. #599

Closed
KCarterSr opened this issue Dec 19, 2017 · 22 comments · Fixed by #601

Comments

@KCarterSr
Copy link

In Visual Studio when I right click on a project, and the select:

EF Core Power Tools --> Reverse Engineer -->
Choose Database Connection --> Select Tables To Script -->
Generate EF Core Model In Project ...

I get the Error below.

I'm using EF Core Power Tools V.1.0.481 Daily build, and I was using the version from VS Gallery.
Both have same Problem.

I checked ...\AppData\Local\Microsoft\VisualStudio\15.0_5f11fda6\Extensions\uba5o5io.zok
and e_sqlite3.dll file (IS LOCATED IN) both x86 and x64 directories.

Thank you

System.TypeInitializationException: The type initializer for 'Microsoft.Data.Sqlite.SqliteConnection' threw an exception. ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.DllNotFoundException: Unable to load DLL 'e_sqlite3': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
at SQLitePCL.SQLite3Provider_e_sqlite3.NativeMethods.sqlite3_libversion_number()
at SQLitePCL.SQLite3Provider_e_sqlite3.SQLitePCL.ISQLite3Provider.sqlite3_libversion_number()
at SQLitePCL.raw.SetProvider(ISQLite3Provider imp)
at SQLitePCL.Batteries_V2.Init()
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at Microsoft.Data.Sqlite.Utilities.BundleInitializer.Initialize()
at Microsoft.Data.Sqlite.SqliteConnection..cctor()
--- End of inner exception stack trace ---
at Microsoft.Data.Sqlite.SqliteConnection..ctor(String connectionString)
at Microsoft.EntityFrameworkCore.Scaffolding.Internal.SqliteDatabaseModelFactory.Create(String connectionString, IEnumerable1 tables, IEnumerable1 schemas)
at Microsoft.EntityFrameworkCore.Scaffolding.Internal.RelationalScaffoldingModelFactory.Create(String connectionString, IEnumerable1 tables, IEnumerable1 schemas, Boolean useDatabaseNames)
at Microsoft.EntityFrameworkCore.Scaffolding.Internal.ModelScaffolder.Generate(String connectionString, IEnumerable1 tables, IEnumerable1 schemas, String projectPath, String outputPath, String rootNamespace, String contextName, Boolean useDataAnnotations, Boolean overwriteFiles, Boolean useDatabaseNames)
at ReverseEngineer20.EfCoreReverseEngineer.GenerateFiles(ReverseEngineerOptions reverseEngineerOptions)
at EFCorePowerTools.Handlers.ReverseEngineerHandler.d__2.MoveNext() in C:\projects\sqlcetoolbox\src\GUI\EFCorePowerTools\Handlers\ReverseEngineerHandler.cs:line 111

@ErikEJ
Copy link
Owner

ErikEJ commented Dec 20, 2017

What happens if you copy the e_sqlite3.dll file from the x86 folder to the folder above?

@KCarterSr
Copy link
Author

Same thing.

@ErikEJ
Copy link
Owner

ErikEJ commented Dec 21, 2017

I am discussing a fix: dotnet/efcore#10596

@KCarterSr
Copy link
Author

Okay, Thank you.

@ErikEJ
Copy link
Owner

ErikEJ commented Dec 22, 2017

Fixed in the latest build, let me know if it works for you!

@KCarterSr
Copy link
Author

Yes it works now, but when I select reverse engineer and point it to my SQLITE database, the only thing that happens is I get a json config file only. There are no code files.

@ErikEJ
Copy link
Owner

ErikEJ commented Dec 22, 2017

Check the VS ouput window - does your tabels have primary keys - this is required?

@KCarterSr
Copy link
Author

Sorry, I hadn't noticed the debug windows, that even though it went further than before, I had the error message below.

System.TypeInitializationException: The type initializer for 'Microsoft.Data.Sqlite.SqliteConnection' threw an exception. ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.DllNotFoundException: Unable to load DLL 'e_sqlite3': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
at SQLitePCL.SQLite3Provider_e_sqlite3.NativeMethods.sqlite3_libversion_number()
at SQLitePCL.SQLite3Provider_e_sqlite3.SQLitePCL.ISQLite3Provider.sqlite3_libversion_number()
at SQLitePCL.raw.SetProvider(ISQLite3Provider imp)
at SQLitePCL.Batteries_V2.Init()
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at Microsoft.Data.Sqlite.Utilities.BundleInitializer.Initialize()
at Microsoft.Data.Sqlite.SqliteConnection..cctor()
--- End of inner exception stack trace ---
at Microsoft.Data.Sqlite.SqliteConnection..ctor(String connectionString)
at Microsoft.EntityFrameworkCore.Scaffolding.Internal.SqliteDatabaseModelFactory.Create(String connectionString, IEnumerable1 tables, IEnumerable1 schemas)
at Microsoft.EntityFrameworkCore.Scaffolding.Internal.RelationalScaffoldingModelFactory.Create(String connectionString, IEnumerable1 tables, IEnumerable1 schemas, Boolean useDatabaseNames)
at Microsoft.EntityFrameworkCore.Scaffolding.Internal.ModelScaffolder.Generate(String connectionString, IEnumerable1 tables, IEnumerable1 schemas, String projectPath, String outputPath, String rootNamespace, String contextName, Boolean useDataAnnotations, Boolean overwriteFiles, Boolean useDatabaseNames)
at ReverseEngineer20.EfCoreReverseEngineer.GenerateFiles(ReverseEngineerOptions reverseEngineerOptions)
at EFCorePowerTools.Handlers.ReverseEngineerHandler.d__2.MoveNext() in C:\projects\sqlcetoolbox\src\GUI\EFCorePowerTools\Handlers\ReverseEngineerHandler.cs:line 120

@KCarterSr
Copy link
Author

C:\projects\sqlcetoolbox\src\GUI\EFCorePowerTools\Handlers\ReverseEngineerHandler.cs:line 120

@KCarterSr
Copy link
Author

Used daily build from EF Core Power Tools Wiki below.

Useful design-time DbContext features, added to the Visual Studio Solution Explorer context menu.

Watch demo on Channel 9

Download from Visual Studio MarketPlace

Download daily build <------------------------------------

@ErikEJ
Copy link
Owner

ErikEJ commented Dec 22, 2017

I cannot reproduce with the latest daily build - can you share a reproduce project and provide VS version

@KCarterSr
Copy link
Author

Do I need to update SQLite/SQL Server Compact Toolbox too?

@ErikEJ
Copy link
Owner

ErikEJ commented Dec 22, 2017

No. Which Power Tools version do you have?

@KCarterSr
Copy link
Author

I see that you put e_sqlite3 into the root folder too. I have version 1.0.486

@ErikEJ
Copy link
Owner

ErikEJ commented Dec 23, 2017

Yes, that was my fix. Let me do some more testing

@ErikEJ ErikEJ reopened this Dec 23, 2017
@ErikEJ
Copy link
Owner

ErikEJ commented Dec 24, 2017

I was able to repro. Will try out this fix: aspnet/Microsoft.Data.Sqlite#249 (comment)

@KCarterSr
Copy link
Author

Ok, I had saw that too. That might work out.

@ErikEJ
Copy link
Owner

ErikEJ commented Dec 26, 2017

Trying this:

Install-Package Microsoft.EntityFrameworkCore.Sqlite.Core -Version 2.0.1
Install-Package SQLitePCLRaw.provider.winsqlite3.net45

ErikEJ added a commit that referenced this issue Dec 26, 2017
@ErikEJ ErikEJ closed this as completed in e02c6a1 Dec 26, 2017
@ErikEJ
Copy link
Owner

ErikEJ commented Dec 26, 2017

Made another attempt at fixing: dotnet/efcore#10596 (comment) - in the latest daily build - please let me know if i works for you!

@KCarterSr
Copy link
Author

Yes, it worked.
Thank you

@ErikEJ
Copy link
Owner

ErikEJ commented Dec 27, 2017

You are welcome, thank you for reporting this issue

@KCarterSr
Copy link
Author

No problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants