Is there ILSplit.exe, which is equivalent to ILMerge.exe, or how can this be done?

Is there a utility for splitting a single .NET assembly into a subset of a complete assembly? That is, a "functional inverse" ILMerge.exe?

This tool, of course, will be difficult to create if it needs to track dependencies, etc. between classes, functions, etc.

However, I am looking for a case where I have a very large (hundreds of MB) mixed-mode assembly, mostly static classes and static methods, mostly just a library of functions. Although, with some initialization of DLLMain and similar.

What I would like is to list the static methods for certain static classes that I want to keep in the assembly of the subset. Technically, this should be possible, since assembly is just binary information with a standardized format.

So is it, or how can this be done? Or why would it be impractical?

+8
c # il mixed-mode ilmerge
source share
1 answer

No, there are very high chances that this tool does not exist. Although the lack of a tool can never be refuted positively.

These IL rewrite recipes do not work on assemblies in mixed mode; ILMerge also does not support them. Such assemblies not only contain IL, they also have machine code and a movement table. There is no easy way to separate machine code, mainly because it is not just clean code, but also contains data. Like transition tables for a switch statement. Also, the reason programmers who write code in their own language are not bothered by obfuscators. Decompiled machine code is the main receiver and is always imperfect.

So, for one, it is likely that your assembly is large because it has a lot of native code. You will need to solve this problem at the project level and divide this Mongo project into smaller ones, distributing the source code between them. That job. And it’s not always always easy, linker errors are a common disaster when you do this. And you probably have to change the code declarations so that they can be exported. Only one way to do this is to start from the very beginning and first separate the subsection, so now you have a not-so-large assembly and a small one. Rinse and repeat. Beware of the cost, many builds slow down the launch of the program.

+3
source share

All Articles