我如何使我的可执行文件更小 [英] How I can make my executable file smaller

查看:63
本文介绍了我如何使我的可执行文件更小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含非常多资源文件的项目

所有资源都是图像

我可以在没有资源文件的情况下编译我的exe文件

并将它们复制到我的ExecutablePath

解决方案

这将取决于您如何访问资源 - 如果您从Properties.Resources中使用它们...那么您将需要更改代码直接访问文件。



但是,这可能不是一个好主意 - 您必须每次检查以确保资源可用或您的应用程序将崩溃,如果您当前正在装饰设计器中的装饰按钮,PictureBox或其他控件,您将无法轻松使用它们。


检查下面的文章,你可以创建自定义操作以将文件复制到安装目录

在Visual Studio Setup Pr中处理大文件对象 [ ^ ]

I have a project with very much resource files
all resources are images
Can I compile my exe file without the resources files
and copy them to my ExecutablePath

解决方案

That's going to depend on how you access the resources - if you use them from Properties.Resources... then you will need to change the code to access the files directly.

However, it may not be a good idea - you will have to check each time to ensure the resource is available or your application will crash, and you won't be able to use them as easily if you are currently "decorating" buttons, PictureBoxes, or other controls in the designer.


check below article, you can create custom action to copy files to installation directory
Handling big files in Visual Studio Setup Projects[^]


这篇关于我如何使我的可执行文件更小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆