我开发了一个对.Net 程序瘦身的工具,可以把被引用但是没有被使用的程序集删除。我用它把一个.Net core 程序从147兆瘦身到59.5兆。

NET has a function to tailor assemblies when publishing programs, but that function can only perform static checks. For example, our project uses assembly A. The classes in assembly A have two methods: M1 and M2. The M1 method calls the code of assembly B, and the M2 method calls the code of assembly C. If our program calls only the M1 method and not the M2 method, then using. NET clipping cannot clip out the C assembly that is called in the M2 method that is not called.
My tool can do runtime checks and delete assemblies that are not called at all at runtime (taking into account dynamic mechanisms such as reflection). NET does not support WinForm and WPF projects either.
The implementation principle of my tool is not complicated, but I searched around and couldn't find similar software, so I wrote one myself. If you know of such a tool, please let me know. If you confirm that this is my first, I will improve the software (test the compatibility of various projects and. NET versions and various operating systems) and release it and open source.
If this project is open source, I will publish it to my self-media. All friends can pay attention to my channels such as Beilai, Today's Headline, Douyin, Weibo, and Youtube. The channel names are all "Yang Zhongke".
Original author: Yang Zhongke
Original link: mp.weixin.qq.com/s/B7QdVQWtgBKNKOEFj2Lg4g