C # Version DLL assembly Merge tool

Source: Internet
Author: User

Recently to develop a control for colleagues, the development will refer to some third-party DLLs, so that the user is very inconvenient, the effect is to directly deliver a DLL file. Found some information on the Internet.

1. Using Costura.fody, this is a powerful place in the build phase can directly merge the dependent DLLs in the target EXE, supporting the unmanaged DLL for mixed mode packaging, the disadvantage is

DLL can only be merged into the EXE, DLL and DLL are not supported by the merge, currently not meet my needs.

Reference http://www.cnblogs.com/instance/archive/2015/10/09/4863811.html

Costura.fody GitHub Address: Https://github.com/Fody/Costura

Costura.fody is a usage scenario: The final release has only one EXE, which merges the dependent DLLs into an EXE.

2. Microsoft's Ilmerge tool.

: https://www.microsoft.com/en-us/download/details.aspx?id=17630

This supports merging EXE-dependent DLLs into the EXE, and also supports merging other DLLs that are dependent on the main dll into a single dll , this basic satisfaction requirements, the only disadvantage is that there is no GUI, every use of knocking command is very inconvenient, so continue to look for, there are Ilmergegui.

3. Ilmergegui

Address: http://ilmergegui.codeplex.com/

This code to download and compile all do not pass, it is not good to use, it seems to be self-clothed.

4. Develop Ilmergegui yourself

Microsoft's ilmerge need to be installed to use, combined with costura.fody to incorporate ilmerge into the tools you develop, without the need to install Ilmerge.

Description

    1. When the main file is a DLL, the merged exported file is a DLL, when the main file type is EXE, the merged file is EXE;
    2. . The DLL file in the list is the dependent file of the main file;
    3. CLR versions support V1, v1.1, V2, V4, and note that the CLR version of the main file and associated files is consistent;

Checking the log output will generate the log file in the tool directory.

Ilmerge Key API:

public void Setinputassemblies (string[] assems);

Sets the input assembly, each of which contains the full name of the absolute path of the file, where the parameter first assembly is the primary assembly. Must be set before calling merge ().

public string OutputFile {get; set;}

Gets or sets the file name that is generated after the merge and must be set before calling merge ().

public void Settargetplatform (string platform, string dir);

Set the. NET Framework target platform, supported by the platform parameter: "v1", "v1.1", "V2", "V4", and the second parameter is the mscorlib.dll directory

Public Ilmerge.kind Targetkind {get; set;}

Gets or sets the target platform type (Windows application, DOS application, DLL)

public enum Kind

{

Dll = 0,

Exe = 1,

Winexe = 2,

sameasprimaryassembly = 3,

}

This tool is set to sameasprimaryassembly, which is the same as the main assembly of the input file.

public void Merge ();

Start merging.

Tool Download: Http://files.cnblogs.com/files/sndnnlfhvk/ILMergeGUI.zip

SOURCE Download: Http://files.cnblogs.com/files/sndnnlfhvk/ILMergeGUICode.zip

C # Version DLL assembly Merge tool

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.