A lot of people are wondering whether it's possible to ILMerge unmanaged DLLs. Unfortunately, standard ILmerge can't do it. It supports .Net modules only.
But with BoxedApp Packer you can include both managed and unmanaged DLLs into an executable file.
The Virtualization To The Rescue!
For BoxedApp Packer it doesn't matter what kind of files are packed together, that's why it's possible to avoid ILMerge restrictions. ILMerge copies all definitions, the code, the metadata from one assembly to another one. At the same time, an executable made by BoxedApp Packer uses virtualization: embedded files are emulated (being located in memory, not at a disk).
How it works? Each call to the file system are intercepted and preprocessed, thus it's possible to create pseudofiles (in BoxedApp we call them "virtual files"). It doesn't matter if such file is a DLL (managed or unmanaged), a data file, a video file, or a database file etc.
First of all download BoxedApp Packer and run it. You will see the main window. There are editboxes to specify input and output (i.e. packed) files, there are predefined directories (Application Directory, System32 and others).
Select your .Net executable, add required unmanaged DLLs to Application Directory:
Build it and run. It works!
Select .Net exe
Packed .Net exe
Both sources and BoxedApp Packer project are available on GitHub.
BoxedApp is a virtualization library, an executable packer, and a developer API to create custom packers.