简体   繁体   English

安装程序执行什么任务? (单个文件)

[英]What tasks does an installer perform? (Single file)

Assuming a single executable and nothing else. 假设一个可执行文件,别无其他。

What I have so far: 到目前为止,我有:

  1. Put the file somewhere. 将文件放在某处。
  2. Create a start menu shortcut. 创建一个开始菜单快捷方式。
  3. Install .net. 安装.net。

Is there anything else? 还有别的事吗?

Creating an installer is much complicated, if you analyze the backend operations it performs. 如果您分析安装程序执行的后端操作,则创建安装程序会非常复杂。 Copying some files and creating some shortcuts its the easy part, but an installer must also handle correctly failed installations (ie rollback all the system changes), cases when it tries to update a file in used by the system, UAC elevation, patching, application/system requirements, etc... 复制一些文件并创建一些快捷方式是最简单的部分,但是安装程序还必须正确处理失败的安装(即回滚所有系统更改),例如在尝试更新系统正在使用的文件,UAC提升,修补,应用程序时/系统要求等。

There have been people that already analyzed all these cases and solution were implemented, you should not try to re-invent the wheel, there are tools (free and paid) that can generate you an installer in just a couple of minutes, and also integrate with Windows development IDEs. 有些人已经分析了所有这些情况,并且已经实施了解决方案,您不应该尝试重新发明轮子,有些工具(免费和付费)可以在短短几分钟内为您生成安装程序,并且可以集成Windows开发IDE。

Since you have a simple installer Wix should be more than enough for you, its the best free option on the market, very powerful and versatile. 由于您有一个简单的安装程序, Wix对于您来说已经足够了,它是市场上最好的免费选项,功能强大且用途广泛。 It has the disadvantage of being script based, but your installer you can find a lot of examples. 它的缺点是基于脚本,但是在安装程序中您可以找到很多示例。 There also paid tools , if you don't like scripting. 如果您不喜欢脚本,也可以使用付费工具

Please use the existent APIs for basic installing needs, it is a waste of your time to try writing your own installer from scratch. 请使用现有的API来满足基本安装需求,尝试从头开始编写自己的安装程序会浪费您的时间。 And even if you do, you will never get an installer package as solid and standards-compliant as it would happen if you would use professional tools to build the installer. 即使这样做,您也永远不会获得像使用专业工具来构建安装程序那样可靠且符合标准的安装程序包。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM