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

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

问题描述

通常我的exe有dll依赖关系,我使用安装程序打包,如 nsis inno
这对大型程序来说是有意义的,但是对于小脚本来说,这是非常有用的。



有没有一种方法来捆绑依赖关系,所以用户只需执行一个exe并且不需要PATH中的dll的目录?






编辑



我希望得到一个不依赖于dll类型的解决方案,并且也可以用于其他类型的依赖。



这里是一些潜在的选择:





有没有人有这样的工具的经验?

解决方案

好的,你没有像我的其他两个想法一样...所以这里... ...



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



您可以优化它,以便如果应用程序已经安装在%TEMP%中,然后跳过拆包步骤,只需启动EXE已经存在的应用程序。



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


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.

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?


EDIT

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...

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.

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.

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天全站免登陆