-
-
Notifications
You must be signed in to change notification settings - Fork 276
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
Microsoft.Data.Sqlite #1004
Comments
I recommend trying the latest 6.0 beta since that also supports .net core runtime. Also a full FodyWeavers.xml would be helpful. Please also check the embedded libraries via ILSpy (or a similar tool). |
I wrote How to package a single-file executable using the SQLite EF Core Database Provider on .NET Framework? on Stack Overflow on September 14, 2020. I have not tried with recent versions but this guide can probably get you on the right track. Also, if you are deploying for .NET (Core) instead of .NET Framework you should probably consider Single-file deployment instead of Costura. |
I tried your post but without success. It seems to work but SQLitePCLRaw.batteries_v2.dll keeps getting called and fails to load the assemblies not present. (For this behavior I need to remove SQLitePCLRaw.batteries_v2.dll from the ReferenceCopyLocalPaths remove tag). If i leave SQLitePCLRaw.batteries_v2.dll in the ReferenceCopyLocalPaths tag as in yout article, my application stops earlier in SQLite3Provider_dynamic_cdecl because it can't find the batteries dll.
I think it originates from the SqliteConnection code which calls/loads SQLitePCLRaw.batteries_v2:
|
I updated my sample project at https://gist.github.com/0xced/701bcfec9c54bc0c151a365923b74e69 with different package references, using Here are the instructions on how to test it:
This should print this message:
|
I just created a new repository that demonstrates how to package This is the definitive answer. 😉 |
Amazing work @0xced , thank you! I don't want to spoil the party, but v6 will work a bit differently 👿 (but is backwards compatible 🤞 ), so maybe you might have to update it one more time in the near future 😉 |
Having some additional issues with the code posted (it seems to work but my code uses: I also have some issues debugging it (when debugging Costura does not seem to pack on running code). |
Found the issue was partly at my side, altough while: Assembly.GetExecutingAssembly().Location was null, it turned out it wasn't pointing to the main exe (as i thought) but to a linked projects output where a resource from this dll needed to be extracted. Excluding the assembly from Costura and using typeof().Assembly seems much more appropriate. |
When processing with Costura, typeof(Authenticated).Assembly.Location is also empty for the assembly i need for resource extraction (so not usable). Seems the best option for now is to exclude the assembly from Costura treatment. |
Everyting is working nicely (except that i get a InvalidOperationException exception when creating the SqliteConnection (but my SqliteConnection property is assigned so a try/except around it works).
|
Thank you for this! Was having trouble. Just to highlight for others trying to merge into their projects, the important stuff (the actual copying of the dlls) is the in .csproj file |
Is there (already) a working solution/guide to include 'Microsoft.Data.Sqlite' (v8.0.1 in my case) in a project with Fody.Costura enabled (v5.0.7)?
Compiling/builing is ok but when started it does not get far into the database code and trips on path issues.
The most suggested methods, using costura folders and Unmanaged64Assemblies / Unmanaged32Assemblies xml section fails (I put for example e_sqlite3.dll into these sections and various other sugestions by google) but without (working) result.
The text was updated successfully, but these errors were encountered: