Reference -
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 machinehttp://www.microsoft.com/en-us/download/details.aspx?id=17630
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
ILMerge Command
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
Example:
C:\Program Files\Microsoft\ILMerge>ilmerge C:\Publish\MyProgram.exe C:\Publish\MyLibrary.dll /out:C:\Publish\MyWinApp.exe /target:winexe /ndebug
Another example
C:\Program Files (x86)\Microsoft\ILMerge>ilmerge D:\Messaging\Debug\WorkflowMessaging.dll D:\Messaging\Debug\DynCRMMessagingIntegration.Common.dll
/keyfile:D:\Messaging\Debug\test2.snk /out:D:\Messaging\Debug\WorkflowMessaging1.dll
with snk file in CRM.
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.
No comments:
Post a Comment