Giorgi / EntityFramework.Exceptions

Handle database errors easily when working with Entity Framework Core. Supports SQLServer, PostgreSQL, SQLite, Oracle and MySql.
https://giorgi.dev/entity-framework/introducing-entityframework-exceptions/
Other
1.22k stars 67 forks source link

Duplicate sqlite dll on build #72

Closed alex6dj closed 3 weeks ago

alex6dj commented 4 months ago

Hi Im creating a new project and want to use this library. Im trying to use a password protected SQlite DB. For this I should reference microsoft.entityframeworkcore.sqlite.core because it dont have an sqlite dll embeded and use sqlitepclraw.bundle_e_sqlcipher wich support encrypted DB.

The issue is that EntityFramework.Exceptions have an internal dependency in microsoft.data.sqlite without core and the result build contains both sqlite versions.

The result buid: With EntityFramework.Exceptions contains e_sqlcipher.dll and e_sqlite3.dll image

Without EntityFramework.Exceptions, only e_sqlcipher.dll image

Any workaround is welcome.

Thanks in advance.

Giorgi commented 4 months ago

Is simply deleting e_sqlite3.dll from the bin directory enough? If yes you could add a post build step as a workaround.

alex6dj commented 4 months ago

Well Im not shure if deleting e_sqlite3.dll from the bin directory is enough. I will do some tests later. About the post build. I check an there are several files that should be deleted. Im doing this image and seems to work during a normal build image but fails when publishing single file (and Aot) using console image Im not really good with build tooling, any help is welcome.

alex6dj commented 4 months ago

I, sorry for the late answer. I check and droping e_sqlite3.dll manually solve the problem and some basic testing shows the app only using the e_sqlcipher.dll. Is yet to test if trimming remove the unneeded dll or not. Just need to find a way to remove before single file generation.

Giorgi commented 2 months ago

@alex6dj Is this still an issue?

alex6dj commented 2 months ago

Hello. Yes, I still think it is a problem yet. Not directly now, but in the future. For now I am removing the extra dlls using the command I published in the previous post, but in the long run the idea is to publish the app using NativeAOT and by not removing the dlls it will increase the final size of the application unnecessarily. Apart from this, by eliminating the unnecessary dlls the application works correctly.

Giorgi commented 3 weeks ago

I added a new package https://www.nuget.org/packages/EntityFrameworkCore.Exceptions.Sqlite.Core that depends on Microsoft.Data.Sqlite.Core instead of Microsoft.Data.Sqlite