自解压 Zip:使用 .exe 文件指定解压路径

发布于 2024-12-13 18:10:25 字数 422 浏览 4 评论 0原文

我正在制定 C# Winforms 应用程序的部署计划,并希望使用自解压 .zip 文件来分发所有必需的文件。以下是 SFX 的文件结构:

Setup.exe
应用程序.exe
应用程序2.exe
自述文件.txt
Manual.pdf

用户运行 SFX 后,我希望 Setup.exe 控制并复制 app.exeapp2.exe >、readme.txtmanual.pdf 到位置 x。它们复制到的路径将取决于用户从 Setup.exe 的 UI、系统属性等中所做的选择。

我将如何编写 Setup.exe C#?

I'm working on a deployment plan for a C# Winforms application and would like to use a self-extracting .zip file to distribute all of the required files. Here is the file structure of the SFX:

Setup.exe
app.exe
app2.exe
readme.txt
manual.pdf

After the user runs the SFX, I want Setup.exe to take control and copy app.exe, app2.exe, readme.txt, and manual.pdf to location x. The path they are copied to will depend on choices the user makes from the UI of Setup.exe, system properties, etc.

How would I go about writing Setup.exe in C#?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

蝶舞 2024-12-20 18:10:25

就我个人而言,我在使用 NSIS 作为设置工具方面获得了非常好的体验。它比 SFX 稍微复杂一些,但确实很好用,相当灵活且免费。

因此,我建议您不要用 C# 编写自己的 SFX(又名“重新发明轮子”),而应该使用经实际验证的现有内容。

当然,还有许多其他可用的安装程序

Personally, I had very good experiences with using NSIS as a setup tool. It's a bit more than a SFX but really good to use, rather flexible and free-of-charge.

So I recommend that you do not write your own SFX in C# (aka "re-inventing the wheel") but rather use something existing that is real-world-proofen.

There are, of course, a lot of other installers available.

二货你真萌 2024-12-20 18:10:25

我同意,当已经有可用的安装程序时,不要浪费时间编写安装程序。如果您出于某种原因选择自己编写一个语言,我会鼓励您远离任何需要依赖项的语言(例如,C# 需要 .Net 运行时)。我建议使用 C 或 C++ 并使用 / 打开静态链接MT 标志 以便您的安装程序尽可能少地依赖。

我使用过的一些安装软件(按优先顺序排列):

有关其他选项,请参阅 Wikipedia 上的安装软件列表文章。

I agree, don't waste your time writing an installer when there are already ones available. If you did chose to write one on your own for whatever reason, I would encourage you to stay away from any languages that require dependencies (e.g. C# requires the .Net Runtime). I would suggest using C or C++ and turning on static linking using the /MT flag so that your installer is dependent on as little as possible.

Some of the installation software I've used (in order of preference):

See the list of installation software article on Wikipedia for other options.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文