使用WiX获取INI文件的值 [英] Get INI file value with WiX
问题描述
我想从WiX安装程序的INI文件中读取一个值.我刚刚尝试使用IniFileSearch,但这会查找INI文件或INI文件中指定的路径(文档尚不清楚),它不会从INI 读取值文件.
I'd like to read a value from an INI file in a WiX installer. I've just tried to use IniFileSearch, but this looks for an INI file or a path specified in an INI file (the documentation isn't clear), it doesn't read a value from an INI file.
我需要执行定制动作吗?如果是这样,人们会提出什么建议?但是,如果WiX没有此功能,这似乎很奇怪!
Do I need a customaction to do this? And if so, what would people suggest? Seems very strange if WiX doesn't have this, though!
我正在使用的代码:
<Property Id="SP">
<IniFileSearch Id="SearchSPVersion" Name="sp.ini" Section="ServicePack"
Key="Version" Type="raw">
<DirectorySearch Id="SPIniFilePath" Path="[CFGPATH]">
<FileSearch Id="SPIniFile" Name="sp.ini"/>
</DirectorySearch>
</IniFileSearch>
</Property>
INI文件:
[ServicePack]
Version=1
我尝试了是否进行目录和文件搜索(在'name'中使用完整路径),并且尝试了type ="raw","file"和"directory".
I've tried with and without the directory and file search (using full path in 'name'), and I've tried type = "raw", "file" and "directory".
推荐答案
在DTF自定义操作中尝试以下操作: C#中的INI文件读取器
Try this in a DTF custom action: INI File Reader in C#
这篇关于使用WiX获取INI文件的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!