Using LIBZ to merge. NET assemblies

Source: Internet
Author: User

Recently wrote a small WPF program, published when found to rely on two or three 20~30k small dll, feel a bit uncomfortable, want to merge it. Previously used Microsoft's ilmerge to merge assemblies under WinForm, but remember that it does not support WPF programs very well. I searched the internet and found a way to embed resources combining multiple assemblies into a single EXE for a WPF application, the garden also an article introduced this way: WPF DLLs and EXE merge into a The new EXE.

The principle of this way is not complicated, but feel this generic way should be able to achieve through the tool, each program is so a little trouble, then continue to search, found on the CodePlex a program called LIBZ container can help us to quickly achieve this process, It is a command-line tool, using the following methods:

???? Libz inject-dll--assemblyMyApplication.exe--include *.dll--move

There are many other parameters to this tool, which can be seen in detail. Since the principle of this tool is to embed the DLL as a resource in the main assembly, and libz packaging when it seems to do a compressed action, in theory will affect the startup speed. However, the need to merge assemblies is generally a small program, and there is no big impact yet.

In addition, found that the tool is quite a lot of, at that time found there is Netz (need FQ), Il-repack,costura.fody, a simple test of two, the sense of focus is different, but just packaging DLLs, the effect is basically similar.

It is important to note that when the main program in XAML relies on resource files provided by other DLLs (theme styles and other resource dictionaries), because the dependency on the assembly is embedded in the program as a BAML file, it is troublesome to merge such an assembly with resources to modify these BAML files. , and has not seen that tool to do so. Therefore, the DLL for the resource cannot be joined by the Assembly, and the dependency of the resource file's DLL cannot be removed.

Using LIBZ to merge. NET assemblies

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.