How to use ilMerge to merge dll into an exe file?

user2016207 picture user2016207 · Jan 27, 2013 · Viewed 28.8k times · Source

Possible Duplicate:
Merging .dll with .exe

Okay, so... I have all the files of ilmerge, along with the .exe (CabalMain.exe) and the dll (crckd.dll) in one path. C:\Program Files (x86)\Microsoft\ILMerge

I shift>rightclick folder and open up command prompt. Since I'd like to merge the two I enter:

    C:\Program Files (x86)\Microsoft\ILMerge>C:\Program Files (x86)\Microsoft\ILMerg
e\ilmerge C:\Program Files (x86)\Microsoft\ILMerge\Cabalmain.exe C:\Program File
s (x86)\Microsoft\ILMerge\crckd.dll /out:C:\Program Files (x86)\Microsoft\ILMerg
e

(I believe that is the correct process to merge) And I received

C:\Program Files (x86)\Microsoft\ILMerge>C:\Program Files (x86)\Microsoft\ILMerg
e\ilmerge C:\Program Files (x86)\Microsoft\ILMerge\Cabalmain.exe C:\Program File
s (x86)\Microsoft\ILMerge\crckd.dll /out:C:\Program Files (x86)\Microsoft\ILMerg
e

In case I didn't yet give it away, I'm a complete imbecile when it comes to this; simple instructions would be appreciated. Thanks in advanced!

Answer

rene picture rene · Jan 27, 2013

As you have now copied every thing in the programs folder of ilmerge (which is not wise and was adviced against in the duplicate question) the correct command (from the ilmerge folder) should be:

ilmerge cabalmain.exe crckd.dll /out:%userprofile%\cabalmainmerged.exe

If no errors are shown you can type start %userprofile% and in the explorer window that opens you should find cabalmainmerged.exe

'Could not load assembly ' means that the exe or dll files that you try to merge are not copied to the correct folder. If one of the exe or dll's depend on other assemblys they all have to be in the same folder.

Wiser is to have a folder c:\merge and copy all relevant files in that folder. Then start a commandprompt and

c:

cd\merge

then

"C:\Program Files (x86)\Microsoft\ILMerge\ilmerge" "yourexe.exe" "your1stdll.dll" /out:mergedexe.exe