如何使用Wix Toolset检查ini文件是否存在 [英] How to check if ini file exists with Wix Toolset

查看:127
本文介绍了如何使用Wix Toolset检查ini文件是否存在的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个配置的.ini文件.我需要检查它是否存在于新安装中,以避免再次创建它.此外,如果新的.ini有新字段,请添加到现有文件中.

I have an .ini file with configuration. I need to check if it exists in new installation to avoid creating it again. Besides if the new .ini have new fields add to the existing file.

推荐答案

不要将ini文件安装为文件,而是将条目转换为 .microsoft.com/en-us/library/aa369282(v = vs.85).aspx"rel =" nofollow noreferrer> IniFile表条目 .这样就可以将所有ini文件更改都视为原子更改单元",从而可以通过内置的MSI机制进行正确的合并和回滚. 避免所有自定义操作的复杂性.

Don't install an ini file as a file, but convert the entries into IniFile Table entries. This allows all ini file changes to be treated as "atomic change units" that allows proper merging and rollback via built-in MSI mechanism. You avoid all custom action complexity.

正如Chris在其主要升级评论中指出的那样:在Wix/MSI中以正确的方式进行操作,您可以避免因需求变更或更新变得复杂而开始出现的许多问题.正确实施的IniFile更新功能强大且易于处理.

As Chris points out in his major upgrade comment: do things the right way in Wix / MSI and you avoid a lot of problems that start to pop up when requirements change or updates get complicated. IniFile updates implemented the right way are robust and simple to deal with.

在Wix中,您使用 IniFile元素 以实现这一目标.所有合并功能,回滚支持和高级ini文件处理都是免费提供的.您需要做的就是定义在安装过程中ini文件中需要添加或修改的内容.如果不在首位,它也会被创建.

In Wix you use the IniFile Element to achieve this. All merge capabilities, rollback support and advanced ini file handling comes along for free. All you need to do is to define what needs to be added or modified in the ini file during your installation. It will also be created if it is not there in the first place.

使用IniFile元素可能看起来比实际困难. > 这里是示例 .您也可以在此处查看 著名的Wix教程 .

Using the IniFile element may look harder than it is. Here is a sample. You can also have a look at the well known Wix tutorial here.

所有MSI专家一直在重复这一建议:如果存在等效的内置MSI构造,切勿使用自定义操作来更改系统.

All MSI-experts keep repeating this advice: never use a custom action to change a system if there are equivalent built-in MSI constructs.

这篇关于如何使用Wix Toolset检查ini文件是否存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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