如何在exe中捆绑依赖项 [英] how to bundle dependencies in exe

查看:15
本文介绍了如何在exe中捆绑依赖项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的 exe 通常有 dll 依赖项,我使用安装程序打包,例如 nsisinno.这对于大型程序是有意义的,但对于小型脚本来说是多余的.

Often my exe's have dll dependencies that I package with an installer like nsis or inno. This makes sense for large programs but is overkill for small scripts.

是否有另一种捆绑依赖项的方法,以便用户可以只执行单个 exe 而不需要 PATH 中的 dll 目录?

Is there an alternative way to bundle dependencies, so that the user can just execute a single exe and not require a directory of dll's in the PATH?


编辑

我希望有一个不依赖于 dll 类型的解决方案,并且也适用于其他类型的依赖项.

I am hoping for a solution that won't depend on the type of dll's, and will work for other kinds of dependencies too.

以下是一些潜在的选择:

Here are some potential options:

有人使用过这样的工具吗?

Does anyone have experience with a tool like this?

推荐答案

好吧,你不喜欢我的其他两个想法……所以就这样吧……

Ok, you didn't like either of my other two ideas... so here goes...

您发送并给您的客户一个存根 EXE".存根 EXE 不依赖任何其他内容,仅包含一个 ZIP 文件(或安装包或类似文件)作为存根 EXE 中的资源.嵌入在存根 EXE 中的 zip 文件只包含实际的程序 EXE 及其所有依赖的 DLL.当存根 EXE 运行时,它只是将 ZIP 文件解压缩到 TEMP 子目录并启动应用程序 EXE.

You ship and give your customers a "stub EXE". The stub EXE doesn't depend on anything else and just contains a ZIP file (or setup package or similar) as a resource in your stub EXE. The zip file embedded in the stub EXE just contains the actual program EXE and all its dependent DLLs. When the stub EXE runs, it just unpacks the ZIP file to a TEMP sub-directory and launches the application EXE.

您可以对其进行优化,如果该应用程序已经安装在 %TEMP% 中,那么您可以跳过解压步骤,只需启动已经存在的应用程序 EXE.

You could optimize it such that if the app has already been installed in %TEMP%, then you skip the unpacking step and just launch the application EXE already present.

就个人而言,我不会走这条路.如果 EXE 有依赖关系,只需给用户一个安装程序.但是你比我更了解你的用户和客户.

Personally, I wouldn't go this route. Just give the user an installer if the EXE has dependencies. But you know your users and customers better than I do.

这篇关于如何在exe中捆绑依赖项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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