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