Understanding Interop.dll Requirements When Class Libraries Operate C#SQLite

Asked 2 years ago, Updated 2 years ago, 145 views

Thank you for your help.

Not long ago, I asked about the connection of SClite, and I thought it was solved once, but it didn't work out as I wanted, so I would like to ask you a different question.I'm really sorry for the people who answered last time.

New
under the name of SQLitePackage to create an easy-to-use class library for SQLite I created a project as a Windows Form Application, installed System.Data.SQLite.Core on NuGet, wrote the code (class SqlDb) to access the SQLite files database, opened the form, ran it later, and it worked so far.This was resolved in the previous question.

However, if you then put those classes into a class library, launch a separate Windows form project, and then add the SQLitePackage.dll that you just created to your reference, and use it in the code of the form, you'll get an exception if you don't have SQLite.Interop.dll.When I checked, it is true that there are no files in the project and no folders such as x86, x64 are created.

Then, as I created the class library, the calling Windows form application also started to work correctly when I installed the SQLite.Core with NuGet.

What I want to do is to make SQLite available for the calling party's Windows form project by simply browsing and adding only the self-made DLL, SQLitePackage.dll.

I have to install NuGet for each project, but is it possible to omit it?

Thank you for your cooperation.

c# sqlite dll nuget

2022-09-30 19:22

2 Answers

For System.Data.SQLite.Core, see

  • \App.exe (optional, managed-only application executable assembly)
  • \App.dll (optional, managed-only application library assembly)
  • \System.Data.SQLite.dll(required, managed-only core assembly)
  • \System.Data.SQLite.Linq.dll(optional, managed-only LINQ assembly)
  • \System.Data.SQLite.EF6.dll(optional, managed-only EF6 assembly)
  • \x86\SQLite.Interop.dll (required, x86 native interop assembly)
  • \x64\SQLite.Interop.dll (required, x64 native interop assembly)

Copy SQLite.Interop.dll so that you can do this.


2022-09-30 19:22

Selfless.

Apparently, the best solution in the current environment is to make your own NuGet.Thank you to everyone who responded.


2022-09-30 19:22

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.