0

i'm building a class library for SQLite , when i build the project the System.Data.SQLite.dll comes as a standalone dll file and i need it to be merged with my class library in a single dll file i added System.Data.SQLite.dll as a ressource then , add / existing item , and then adding it as an embedded resource

then i drop this static constractor in the start of my namespace

static SimpleClass()
{
    AppDomain.CurrentDomain.AssemblyResolve += (sender, args) =>
    {
        if (new AssemblyName(args.Name).Name.ToLowerInvariant() == "System.Data.SQLite")
        {
            String resourceName = "SQLlite." + new AssemblyName(args.Name).Name + ".dll";
            using (var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(resourceName))
            {
                Byte[] assemblyData = new Byte[stream.Length];
                stream.Read(assemblyData, 0, assemblyData.Length);
                return Assembly.Load(assemblyData);
            }
        }
        else
        {
            return null;
        }
    };
}

This is giving me errors like error CS1518: Expected class, delegate, enum, interface, or struct appreciate any help from you guys

Marc
  • 3,905
  • 4
  • 21
  • 37
aymenbnr
  • 1
  • 1
  • 1
  • This is a compilation error and if you try to do such complicated things you are supposed to be able to know how to fix such errors. And if you want help with compilation errors, at least show the line number. Though I don't think your problem should be solved in this way. – wRAR Feb 06 '13 at 22:37
  • 1
    This is effectively answered here - http://stackoverflow.com/questions/8077570/how-to-merge-multiple-assemblies-into-one - this should provide lots of suggestions as to how to merge your classes together. – dash Feb 06 '13 at 22:37

2 Answers2

0

If you want to make one assembly from two, you can try ILMerge.

wRAR
  • 25,009
  • 4
  • 84
  • 97
0

This will ultimately fail. System.Data.SQLite is a PInvoke wrapper for SQLite.Interop.dll, which is an unmanaged dll, which is not resolved in .net.

Aron
  • 15,464
  • 3
  • 31
  • 64