WPF .exe - large filesize

老子叫甜甜 提交于 2019-12-03 12:48:50
user1182735

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.

This is probably an issue with embedded resources.

If you added images or other resources to the project, even if you delete the file from the project, the resource will remain embedded.

Check the Resources section of project properties.

For example, did you add your images as bitmaps first and later deleted the files and added as png?

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!