如果 WiX 中不存在则复制
我有一个配置文件 myapp.exe.config,只有当它尚不存在时我才想安装它。也就是说,我不想覆盖任何现有的配置文件。在 WiX 中如何做到这一点?
(最终我将不得不做一些更复杂的设置,设置默认值和覆盖等等。但与此同时,我只是在寻找短期修复。)
I have a config file, myapp.exe.config, that I want to install only if it does not already exist. That is, I don't want to overwrite any existing config file. How can this be done in WiX?
(Ultimately I will have to do something more sophisticated with settings, having defaults and overrides and so on. But in the meantime I am just looking for a short-term fix.)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果文件是 keypath 一个组件。例如,如果
foo.config
已经存在(或者在版本文件的情况下,如果已经存在具有相同或更高版本号的文件),则不会安装以下组件:请注意,如果您的组件中有多个文件,那么只能有一个
键路径。您可以通过将文件的
KeyPath
属性设置为yes
来控制这一点。但建议的策略是每个组件只有一个文件,在这种情况下,该文件会自动成为组件键路径。编辑:请注意,可以使用 REINSTALLMODE 属性。您可能需要使用 orca 打开 MSI并查看属性表中是否设置了该属性。
What you describe is the default behavior if the file is the keypath of a component. For example, the following component will not be installed if
foo.config
already exists (or in the case of a versioned file, if a file with a equal or higher version number already exists):Note that if you have multiple files in your component, then only one can be the
keypath. You can control this by setting the
KeyPath
attribute of the file toyes
. But the recommended strategy is to have only one file per component, in which case the file automatically becomes the component keypath.edit: note that this default behavior can be overridden with the REINSTALLMODE property. You may want to open your MSI with orca and see if this property is being set in the property table.
您想在组件上使用 NeverOverwrite 和 Permanent...
我在 config.json 文件上使用它,其中包含非常长的令人讨厌的 Web 服务连接字符串。它永远不应该被任何用户操作清空,并且在卸载后停留在后面。
http://wixtoolset.org/documentation/manual/v3/xsd/ wix/component.html
You want to use NeverOverwrite and Permanent on the component...
I use this on my config.json files that contain really long nasty connection strings to a web service. It should never be blanked out by any user action and linger behind after an uninstall.
http://wixtoolset.org/documentation/manual/v3/xsd/wix/component.html