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.
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 the definitions, code, and metadata from one assembly to the other. At the same time, an executable made by BoxedApp Packer uses virtualization: embedded files are emulated (being located in the memory, not on the disk).
How it works? Each call to the file system is intercepted and preprocessed; thus, it's possible to create pseudofiles (in BoxedApp, we call them "virtual files"). It doesn't matter whether 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. That will pop the main window, which has edit boxes to specify input and output (i.e. packed) files, predefined directories (Application Directory, System32, and others).
Select your .Net executable, add the 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.