Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7507665
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T22:32:06+00:00 2026-05-29T22:32:06+00:00

I have a DLL >> System.Data.SQLite.dll To use it in a normal way >

  • 0

I have a DLL >> System.Data.SQLite.dll

To use it in a normal way > just add it as reference and

using System.Data.SQLite;

then, I can use all the functions inside this DLL.

But, I want to merge my app.exe and this DLL into one single file.
I have tried using ILmerge, but fail. As I know, ILmerge cannot merge unmanage DLL.

So, I tried another method > make the DLL as embbed resource.
I am able to load it as an assembly with the below code:

Stream stm = Assembly.GetExecutingAssembly().GetManifestResourceStream("MyApp.System.Data.SQLite.dll");
byte[] ba = null;
byte[] buffer = new byte[16 * 1024];
using (MemoryStream ms = new MemoryStream())
{
    int read;
    while ((read = stm.Read(buffer, 0, buffer.Length)) > 0)  
    {
        ms.Write(buffer, 0, read);
    }
    ba = ms.ToArray();
}
Assembly sSQLiteDLL = Assembly.Load(ba);

but, how am I going to use the functions in SQLiteDLL?

I also tried add the DLL as resource in properties and load it like this:

public Form1()
{
    AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(CurrentDomain_AssemblyResolve);
    InitializeComponent();
}

System.Reflection.Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args)
{
    AppDomain domain = (AppDomain)sender;
    if (args.Name.Contains("System_Data_SQLite"))
    {
        return domain.Load(MyApp.Properties.Resources.System_Data_SQLite);
    }
    return null;
}

The above explained what I’ve got so far and I don’t know what to do next to use the DLL? I still can’t use the functions inside the DLL.

For example, when I type this:

SQLiteCommand cmd = new SQLiteCommand();

The Visual Studio says:

Error 21 The type or namespace name ‘SQLiteCommand’ could not be found (are you missing a using directive or an assembly reference?)

Can you share your insight? Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T22:32:06+00:00Added an answer on May 29, 2026 at 10:32 pm

    You can embed an assembly AND reference it (in VS) at the same time… for the way you want to use it you need to reference it! Any reason you don’t reference the Assembly ?

    Using a Type from an embedded Assembly (managed) without referencing it is a bit harder but possible using Reflection etc. – see these links (they include reference material AND some sample code etc.):

    • http://msdn.microsoft.com/en-us/library/system.activator.createinstance.aspx
    • https://stackoverflow.com/a/57450/847363
    • http://msdn.microsoft.com/en-us/library/h538bck7.aspx (loads an ssembly from a byte array so there is no need to write that assembly to the filesystem)
    • http://msdn.microsoft.com/en-us/library/system.reflection.assembly.gettype.aspx
    • http://www.codeproject.com/Articles/32828/Using-Reflection-to-load-unreferenced-assemblies-a

    On embedding managed DLLs you have several options:

    • use ILMerge (free)
      For howto see here and here

    OR

    • use some tool like SmartAssembly (commercial)
      it can embed and merge among other things (no need to change your source code)

    OR

    • code that yourself in less than 10 lines (free but minimal source code change)
      mark all needed dependencies as “embedded resource” – this way they are included in the EXE file… you need to setup an AssemblyResolve handler which at runtime reads from Resources and returns the needed DLLs to the .NET runtime…
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have following requirement, I have C#/.Net console application, which refers to 'System.Data.Sqlite.dll' 'System.Data.Sqlite.dll'
Here is my dilemma: The Problem I have SubProgram (a DLL) that uses System.Data.SQLite
Short Version : I'm using a 64bit dll (system.data.sqlite) in an Asp.net MVC app
I have application use SDF file and I use System.Data.SqlServerCe, Version 3.5.0.0 I make
I'm trying to build System.Data.SQLite in Visual Studio using the source code downloaded from
I have a question about getting DLL's directory on Windows system. The situation is
I have a makefile template to compile a single DLL (for a plugin system).
I have tried the following code but has no effect: Imports system.Runtime.InteropServices <DllImport(UxTheme.DLL, BestFitMapping:=False,
I have a dll that was written in c++, I need to use this
I want to implement a function for System.Data.SQLite in C#. Implementing the SQLiteFunction interface

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.