WPF .exe - large filesize

后端 未结 2 1635
栀梦
栀梦 2021-02-14 12:31

I am working on a WPF application and the .exe is found to be over 1.2MB in size. I would like to reduce the size of the final executable. The code is no more than a few 200 Kb,

2条回答
  •  情深已故
    2021-02-14 13:06

    Indirectly referenced default styles with all dependencies they have are usually not visible in code or XAML. I am not sure but if WPF is embedding them into the exe, this could account for some of the overhead. You could test this by removing most of the WPF-dependent code to see whether this significantly influences file size.

    There could also be an overhead due to being WPF and being executable. You could test this by putting your code into a WPF Custom or User Control Library Project. This can be created by visual studio. If for the same content the resulting DLLs are much smaller than the EXE-files, it might be a combination of WPF and being an executable.

    In general, I find a file size overhead not surprising. As a big framework WPF is not known for its tininess and efficiency.

    The two comments to the answer here: "Why is my .net exe so huge" analyzer tool? might also be helpful.

提交回复
热议问题