将配置文件添加到安装程序 (msi) [英] Add a config file to an installer (msi)

查看:47
本文介绍了将配置文件添加到安装程序 (msi)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将带有特殊唯一生成令牌的配置文件添加到 msi 文件?这个想法是用户注册客户端计算机,安装程序在配置文件中带有唯一值.我已经阅读了有关 msidb.exe 的信息,但我想知道是否有更好、更简洁、更简单的解决方案.有什么想法吗?

How can I add a config file with a special uniquely generated token to a msi file? The idea is that the user registers a client computer and the installer comes with the unique values in a config file. I´ve read about the msidb.exe but I would like to know if there is a better, cleaner and easier solution. Any ideas?

推荐答案

添加自定义文件:您可以向 MSI 添加自定义文件,有几种方法这样做,但它相当复杂和笨重.Wise(不再可用)等商业工具允许通过简单的方法添加此类文件.您还可以手动编辑 Media 和 Cab 表.我很久以前写了这个答案,有一些细节:将外部 CAB 添加到带有内部 CAB 的 MSI.

参数化设置:该令牌是某种加密还是许可证密钥?我假设您想为设置提供一些自定义参数?这意味着什么?执照?服务器名称?用户名?网址?或者这是为您的用户生成的二进制文件,安装程序无法轻松生成?如果这些只是配置设置,更好的方法可能是使用转换来设置安装参数,或者您可以在通过 msiexec.exe 命令行安装时向 MSI 提供参数.转换的使用msiexec.exe命令行参数的使用都在这里描述:如何更好地利用 MSI 文件.基本上是您设置将在安装过程中插入到配置文件中的属性.本质上,转换是在安装时应用设置的小数据库片段,以使用特定于用户的设置修改原始安装.因此,它基本上就是您所需要的.也许.变换原则上也可以自动生成 - 通过应用一些肘部润滑脂和耐心.

Parameterized Setups: Is that token some sort of encryption or license key? I assume you want to supply some custom parameters to the setup? What does that entail? License? Server names? User names? URLs? Or is this a generated, binary file for your users that can not be easily generated by the setup? If these are just configuration settings, the better way might be to use a transform to set installation parameters or you can supply parameters to an MSI when it is installed via the msiexec.exe command line. The use of transforms and the use of command line parameters for msiexec.exe are both described here: How to make better use of MSI files. Essentially you set properties that will be inserted into configuration files during installation. Essentially transforms are little database fragments with settings applied at installation time to modify an original installation with user-specific settings. As such it is essentially what you need. Maybe. Transforms can in principle also be auto-generated - by applying some elbow grease and patience.

MSI 配置:一旦您的参数被传递到安装过程,您就可以将它们写入INI> 使用内置的 MSI 结构轻松处理文件.在所有主要工具中也有允许您编写 XML 的扩展.例如,还有其他几个扩展来设置防火墙选项,天知道是什么.我们在谈论什么样的配置文件?您还可以使用自定义操作基本上做任何您想做的事情,更新系统上的文件和其他内容 - 以您自己的解决方案带来的所有潜在错误为代价.

MSI Configuration: Once your parameters have been passed to the installation process, you can write them into INI files easily using built-in MSI constructs. There are also extensions in all major tools that allow you to write XML. And there are several other extensions to set firewall options for example, and God knows what. What kind of config file are we talking about? You can also use custom actions to basically do whatever you want in terms of updating files and other things on the system - with the cost of all the bug potential that comes from rolling your own solutions.

应用程序:通常最好在安装后使用应用程序本身进行应用程序配置.这可以大大简化调试和支持应用程序的过程,而不是依赖于一次性"设置,而无需用户向支持人员报告交互式错误消息.

Application: Often it is better to do application configuration using the application itself after installation. This can drastically simplify the process of debugging and supporting the application rather than depending on a "one-shot-affair" setup without interactive error messages for users to report to support.

总结:所以本质上我要说的是,您可以按照建议注入文件,也可以通过转换或命令行向设置提供参数在磁盘上写入或生成文件,或者您可以让您的应用程序根据您在应用程序启动期间写入 INI 或 XML 文件的设置生成二进制文件.您还可以通过设置 GUI 而不是通过命令行上的 PUBLIC 属性获取要写入配置文件的自定义值.

Summary: So in essence what I am saying is that you can either inject the file as you suggest, you can supply parameters to the setup via transforms or command line to write or generate the files on disk, or you could have your application generate the binary file from the settings you have written to INI or XML files during application launch. You can also obtain the custom values you want to write to the config files via the setup GUI instead of via PUBLIC properties on the command line.

一些链接:

这篇关于将配置文件添加到安装程序 (msi)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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