"A Zero Installation Technique for Portable Applications"
I had a situation where I need to develop a portable application with simple installation. Finally I found a way make it zero installation!
If you are developing a portable Windows based application on .NET platform, you could benefit from IL Merging technique for your deployment.
IL Merge is a technique and a research product from Microsoft, to merge multiple DLLs and EXEs (.NET Assemblies) together to form a merged file (exe or dll). This way no separate DLL file is required.
Follow the below steps for merging an exe and dll associated with the project.
Download and install the ILMerge utility from Microsoft Website.
Step 1: Download ILMerge utility and install it in your machine
Step 2: Compile and Publish your Project to a folder (eg: C:\Publish\)
Step 3: Use the ilmerge command to merge the exe and dll files and output single exe file
Syntax (Simple*): ilmerge <input assembly 1> <input assembly 2> /out:<output file> /target:<dll|exe|winexe>
*For complete set of options and syntax refer ILMerge Documentation
C:\Program Files\Microsoft\ILMerge>ilmerge C:\Publish\MyProgram.exe C:\Publish\MyLibrary.dll /out:C:\Publish\MyWinApp.exe /target:winexe /ndebug
ilmerge – Command
MyProgram.exe – Output from the published folder
MyLibrary.dll – Any library used in the program
/target:winexe – We need to output a single exe file for Windows Platform
/output – Output folder and filename
/ndebug – To disable debug (.pdb file)
Note: Use the exe file first in the order of input files to get .exe as extension for output file.
Please share your experience and suggestions in the comments section below.