windows 安装程序:WIX 还是 Inno Setup?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6245260/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Installers: WIX or Inno Setup?
提问by Brent Arias
I'm comparing these two tools. The impression I have is:
我正在比较这两个工具。我的印象是:
- Inno Setup does not produce an MSI, but can do everything WIX can do
- WIX does produce an MSI, but has a steep learning curve
- Inno Setup 不产生 MSI,但可以做 WIX 可以做的一切
- WIX 确实产生 MSI,但学习曲线陡峭
Do you agree with this characterization? What other differences are there? How does WIX#shake-up this story? Since Inno Setup does not use the windows installer, does it have difficulty with uninstalls? Can Inno Setup, upon command, downgrade an installation to an earlier version - or can it only install / upgrade applications?
你同意这种描述吗?还有哪些不同之处?WIX#如何改变这个故事?由于 Inno Setup 不使用 Windows 安装程序,卸载是否有困难?Inno Setup 是否可以根据命令将安装降级到较早版本 - 还是只能安装/升级应用程序?
采纳答案by Robert Love
It's been a long time since I worked with MSI, when I switched to InnoSetup I never looked back.
自从我与 MSI 合作已经很长时间了,当我切换到 InnoSetup 时,我再也没有回头。
I did not want my installation to be a headache. I needed something where I could "Set it and forget it"
我不想让我的安装头疼。我需要一些我可以“设置并忘记它”的东西
By default InnoSetup produces an uninstall. It can handle simple or complex install and uninstall needs.
默认情况下 InnoSetup 会产生卸载。它可以处理简单或复杂的安装和卸载需求。
With InnoSetup You have a few different ways you can upgrade applications.
使用 InnoSetup 您可以通过几种不同的方式升级应用程序。
- Initially we did use the overwrite method which just overwrote the existing installation.
- Recently we switched an automatic uninstall of the previous version when new version was installed.
- 最初我们确实使用了覆盖方法,它只是覆盖了现有的安装。
- 最近我们切换了安装新版本时自动卸载旧版本。
With InnoSetup downgrades are typically uninstall and reinstall the older version.
InnoSetup 降级通常是卸载并重新安装旧版本。
回答by Lars Truijens
You are right about the MSI not MSI part and you are right that learning curve of MSI is steeper. But both have features others don't. Let me quote Glytzhkofon the advantages of MSI.
你是对的 MSI 而不是 MSI 部分,你是对的,MSI 的学习曲线更陡峭。但两者都具有其他人没有的功能。让我引用Glytzhkof关于 MSI 的优势。
Glytzhkof says hi ;-). Please do read both my original answers on serverfault.comfor a summary of common problems with MSI resulting from its steep learning curve. This answer here focuses on the theoretical benefits, the other answer(in the same thread) summarizes common MSI problems off the top of my head. Additions there are most welcome - I just added the most common issues.
Glytzhkof 打招呼 ;-)。请务必阅读我在serverfault.com上的两个原始答案,以了解 MSI 因陡峭的学习曲线而导致的常见问题。这里的答案侧重于理论优势,另一个答案(在同一线程中)总结了我头脑中常见的 MSI 问题。添加是最受欢迎的 - 我只是添加了最常见的问题。
- Transparency(Open installer format)- An MSI can be reviewed and inspected. This is a huge issuefor large corporations. With the exception of compiled custom actions an MSI file is a "white box". If the setup changes something crazy such as the system-wide network settings, you can actually see it.
- Customizability- An MSI can be customized via transforms to fit an organization's needs and standards whilst still allowing interoperability with the vendor's installer updates. You don't change the installer itself, you create your customization in a separate, organization-specific file called the transform. You are free to disable custom actions and in general anything in the installer, and "black box" custom actions can be approved by contacting the vendor for explanation. These transform files are also sometimes used to localize an MSI file to different languages. Several transforms can be applied to a single MSI.
- Standardization- MSI does not lend itself to "allowing anything". It provides a comprehensive framework for the installer, which crucially also includes the uninstall - all in standard format. The installer GUI is also standardized with built-in features to support silent installation and uninstallation which can be triggered remotely.
- Management and reporting- Windows Installer maintains a comprehensive database of all items a product has installed. You can reliably determine if a product is installed, what features were installed, and what file versions were installed. In addition you can get a list of any patches that have been applied to the base product, if any.
- Security- following from the comprehensive installation database it is possible to detect security vulnerabilities in the installed products. MSI also encompasses "elevated rights"principles which allows a restricted user to trigger the install of a product that requires admin privileges to install. This is part of the "advertisement feature" which allows an administrator to make installers available to users without actually installing them on all workstations. There is no need to mess with temporary rights to get things working.
- Validation- MSI files can be checked with validation rules to ensure it is in compliance with a number of internal consistency rules (referred to as ICE). Corporations can create their own ICE checks to enforce special corporate rules and requirements. This helps greatly with QA.
- Resiliency- The Admin installfeature of Windows installer provides a standard way to extract the source files from an MSI. These source files can then be put on a share and be available to all workstations for installation. This ensures repair, uninstall and modify operations complete without requesting the installation media on CD or similar. This is particularly important for patching and update operations which may require access to the old versions source files in special circumstances.
- Rollback- The installation of an MSI file will normally trigger the creation of a restore point. Furthermore all files and registry items replaced or overwritten during the installation will be saved and restored if the install fails to complete. This ensure that the workstation is left in a stable state even if the install should fail. As you might expect poorly designed MSI files can violate the built-in features of Windows here, see my other post in this thread for more details.
- Patching & Updates- though highly complex patching in Windows installer is fully managed and registered on the system so that a systems security state can be determined by checking what has been installed. Updates are standardized to a few basic variants, and this allows updates to be performed with a higher degree of certainty. Deployment systems will be able to report what updates failed and why.
- Logging- Windows Installer provides a standardized logging feature which is greatly superior to previous incarnations, though almost excessively verbose. Log files can be deciphered using log analyzers, and custom log levels can be used to eliminate generating too large log files with unnecessary information. For debugging purposes verbose logging is extremely useful. See Rob Mensching's blogfor a good manual way to read an MSI log file.
- 透明度(开放安装程序格式)- 可以和检查 MSI。这对大公司来说是个大问题。除了编译的自定义操作之外,MSI 文件是一个“白框”。如果设置更改了一些疯狂的东西,例如系统范围的网络设置,您实际上可以看到它。
- 可定制性- MSI 可以通过转换进行定制,以适应组织的需求和标准,同时仍允许与供应商的安装程序更新进行互操作。您无需更改安装程序本身,而是在名为转换的单独的、特定于组织的文件中创建自定义。您可以随意禁用自定义操作以及安装程序中的任何内容,并且“黑匣子”自定义操作可以通过联系供应商进行解释来批准。这些转换文件有时也用于将 MSI 文件本地化为不同的语言。多个变换可以应用于单个 MSI。
- 标准化- MSI 不适合“允许任何事情”。它为安装程序提供了一个全面的框架,其中最重要的是还包括卸载 - 全部采用标准格式。安装程序 GUI 还具有标准化的内置功能,以支持可远程触发的静默安装和卸载。
- 管理和报告- Windows Installer 维护一个产品已安装的所有项目的综合数据库。您可以可靠地确定是否安装了产品、安装了哪些功能以及安装了哪些文件版本。此外,您可以获得已应用于基本产品的任何补丁的列表(如果有)。
- 安全性- 根据综合安装数据库,可以检测已安装产品中的安全漏洞。MSI 还包含 “提升权限”原则,允许受限用户触发需要管理员权限才能安装的产品的安装。这是“广告功能”的一部分,它允许管理员向用户提供安装程序,而无需在所有工作站上实际安装它们。没有必要弄乱临时权限来使事情正常进行。
- 验证- 可以使用验证规则检查 MSI 文件,以确保其符合许多内部一致性规则(称为 ICE)。公司可以创建自己的 ICE 检查来执行特殊的公司规则和要求。这对 QA 有很大帮助。
- 弹性- Windows 安装程序的管理员安装功能提供了一种从 MSI 中提取源文件的标准方法。然后可以将这些源文件放在共享上并可供所有工作站使用以进行安装。这可确保修复、卸载和修改操作完成,而无需请求 CD 或类似物上的安装介质。这对于在特殊情况下可能需要访问旧版本源文件的修补和更新操作尤其重要。
- 回滚- 安装 MSI 文件通常会触发创建还原点。此外,如果安装未能完成,所有在安装过程中替换或覆盖的文件和注册表项都将被保存和恢复。这可确保即使安装失败,工作站也能保持稳定状态。正如您可能认为设计不当的 MSI 文件可能会违反 Windows 的内置功能,请参阅我在此线程中的另一篇文章了解更多详细信息。
- 修补和更新- 尽管 Windows 安装程序中高度复杂的修补是在系统上完全管理和注册的,因此可以通过检查已安装的内容来确定系统安全状态。更新被标准化为几个基本变体,这使得更新能够以更高的确定性执行。部署系统将能够报告哪些更新失败以及原因。
- 日志记录- Windows Installer 提供了一个标准化的日志记录功能,虽然几乎过于冗长,但它大大优于以前的化身。可以使用日志分析器解密日志文件,并且可以使用自定义日志级别来避免生成包含不必要信息的过大日志文件。出于调试目的,详细日志记录非常有用。有关读取 MSI 日志文件的良好手动方法,请参阅Rob Mensching 的博客。
回答by Mike
I'm late to responding to this thread. I have used Inno Setup for my company's product for years. It does most things very well but the biggest hurdle for me is custom actions. In Inno Setup, one must use a variant of the Pascal language. With the WiX Toolset, I can and do use C# for my custom actions which is much more comfortable for me. Admittedly, that is a personal preference but it is the primary reason why I switched from an otherwise excellent Inno Setup platform to an also excellent WiX platform. That, and the fact that there were so many benefits from using MSIs which have already been mentioned in another response.
我迟到了回复这个线程。我多年来一直将 Inno Setup 用于我公司的产品。它在大多数事情上做得很好,但对我来说最大的障碍是自定义操作。在 Inno Setup 中,必须使用 Pascal 语言的一种变体。使用 WiX 工具集,我可以并且确实将 C# 用于我的自定义操作,这对我来说更加舒适。诚然,这是个人喜好,但这是我从其他出色的 Inno Setup 平台切换到同样出色的 WiX 平台的主要原因。那个,以及使用 MSI 有很多好处的事实,这在另一个回复中已经提到。
Frankly, for me, the learning curve of Pascal was greater than that of WiX using the book, WiX 3.6: A Developer's Guide to Windows Installer XML.
坦率地说,对我来说,Pascal 的学习曲线比使用WiX 3.6:Windows Installer XML 的开发人员指南一书的WiX 大。
回答by CubicleSoft
I realize this answer comes VERY late. But I ran into this post and figured one answer to the question could simply be: "Why not have both?" (eat cake and have it too) and also "Why expend the effort on implementing both when I could just expend the effort for one and get the second one for practically free?"
我意识到这个答案来得太晚了。但是我遇到了这篇文章,并认为这个问题的一个答案可能只是:“为什么不两者兼而有之?” (吃蛋糕也吃)还有“当我可以只花一个精力而实际上免费获得第二个时,为什么还要花费精力来实施这两个项目?”
Toward that end, I present an Inno Setup script w/ MSI support:
为此,我提出了一个具有 MSI 支持的 Inno Setup 脚本:
https://github.com/cubiclesoft/php-app-server/blob/master/installers/win-innosetup/yourapp.iss
https://github.com/cubiclesoft/php-app-server/blob/master/installers/win-innosetup/yourapp.iss
There are some custom Pascal functions in use here that kick in when passed /MSI={GUID}
on the command-line that trigger useful changes to the script (e.g. no Uninstall icon in Start or Add/Remove Programs).
此处使用了一些自定义 Pascal 函数,它们在通过/MSI={GUID}
命令行传递时会触发脚本的有用更改(例如,“开始”或“添加/删除程序”中没有“卸载”图标)。
And I present a WiX script w/ support for the above Inno Setup script:
我提出了一个支持上述 Inno Setup 脚本的 WiX 脚本:
https://github.com/cubiclesoft/php-app-server/blob/master/installers/win-wix/yourapp.wxs
https://github.com/cubiclesoft/php-app-server/blob/master/installers/win-wix/yourapp.wxs
The WiX script wraps the Inno Setup-based installer EXE (the only payload) in a way that triggers the Inno Setup script to do things in a more MSI-compatible way and cranks out the MSI. It isn't perfect, but it saves a ton of time by letting you do things the Inno Setup way and then get most of the benefits of MSI (e.g. GPO/SCCM/DSC silent deployment) without pulling hair. This works best if mostly just deploying files to the system and a handful of registry entries (i.e. a basic app). I wouldn't recommend this approach for a larger application where there are lots and lots of components, but if you try it and it works, let me know! Having a MSI version that launches the Inno Setup EXE at least gives sysadmins doing deployments something reasonable to chew on.
WiX 脚本包装基于 Inno Setup 的安装程序 EXE(唯一的有效载荷),触发 Inno Setup 脚本以更兼容 MSI 的方式执行操作并生成 MSI。它并不完美,但通过让您以 Inno Setup 的方式做事,然后在不费吹灰之力的情况下获得 MSI 的大部分好处(例如 GPO/SCCM/DSC 静默部署),它可以节省大量时间。如果主要只是将文件部署到系统和少量注册表项(即基本应用程序),则效果最佳。对于包含大量组件的大型应用程序,我不会推荐这种方法,但是如果您尝试它并且它有效,请告诉我!拥有启动 Inno Setup EXE 的 MSI 版本至少可以让系统管理员在进行部署时有一些合理的考虑。
Note that the WiX script depends on the custom Pascal functions on the Inno Setup side of things. You can't just take any ol' Inno Setup installer and wrap it with the WiX script and expect it to work (it probably won't). But maybe a future version of Inno Setup will natively support something similar.
请注意,WiX 脚本依赖于 Inno Setup 方面的自定义 Pascal 函数。您不能只使用任何 ol' Inno Setup 安装程序并用 WiX 脚本包装它并期望它工作(它可能不会)。但也许 Inno Setup 的未来版本本身会支持类似的东西。
回答by Lothar
We integrated both into our build system.
我们将两者都集成到我们的构建系统中。
But we decided to promote innosetup exe files for non business customers and msi only on demand for one simple reason.
但出于一个简单的原因,我们决定仅按需为非商业客户和 msi 推广 innosetup exe 文件。
You can't ship a multi-localized version of setup program with MSI. You would need one installer for every language and this sucks huge. There might be some heavy hacking allowing you to rewrite the whole GUI but this is not well documented and no open source to steal and a lot of work.
您不能随 MSI 一起提供安装程序的多本地化版本。每种语言都需要一个安装程序,这太糟糕了。可能有一些严重的黑客攻击允许您重写整个 GUI,但这没有很好的文档记录,也没有可以窃取的开源和大量工作。
The GUI is infact tbe worst part on WiX which otherwise is technically superior to Innosetup.
GUI 实际上是 WiX 上最糟糕的部分,否则在技术上优于 Innosetup。
With Innosetup it's easy to ship one exe in 5 languages. We already have 6 binaries [Free,Home,Pro - each 32/64bit] so the variant explosion would be just huge and if you market a japanese version with a japanese webpage and the first thing that comes up is an english only installation it is a bad impression.
使用 Innosetup 可以轻松地以 5 种语言发布一个 exe。我们已经有 6 个二进制文件 [免费的、家庭的、专业的 - 每个 32/64 位],所以变体的爆炸将是巨大的,如果你销售带有日文网页的日文版本并且出现的第一件事是只有英文的安装,那就是不好的印象。
The MSI for business users who need group policies etc. is english only and thats fine for business users.
需要组策略等的商业用户的 MSI 只有英语,这对商业用户来说很好。