如何使用 Wix 搜索和替换配置文件?

发布于 2024-09-19 03:28:39 字数 396 浏览 1 评论 0原文

我继承的一些代码将其“配置”(如果您可以这样称呼它)嵌入到其 PHP 和 ASP(不要问)代码中。因为它不是 XML 或 INI 文件,所以我花了很多时间来弄清楚如何在安装时修改这些文件。如果可以的话,我想做一个简单的搜索和替换。我在其他地方读过(WiX 在配置文件上搜索和替换) 我应该只写一个自定义操作。如果可以的话,我宁愿避免它,因为我希望配置的代码已被弃用,并且我不想创建另一个项目来支持此代码。

那么有没有一种方法可以在不编写自定义操作的情况下做到这一点。如果没有,是否有人知道任何已经构建的自定义操作可以帮助我完成此任务?

Some code I inherited has its "configuration" (if you can call it that) embedded into its PHP and ASP (don't ask) code. Because its not an XML or INI file, I'm having the darnedest time figuring out how to modify these files at install time. If I could, I'd like to do a simple search and replace. I've read elsewhere (WiX Search and Replace on a configuration file) that I should just write a Custom Action. I'd rather avoid it if I could since the code I wish to configure is deprecated and I don't want to create yet another project to support this code.

So is there a way to do this without writing a custom action. If not, is anyone aware of any custom actions that are already built that could help me with this task?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

心清如水 2024-09-26 03:28:39

Windows Installer 内置了对 INI 文件的支持,WiX / InstallShield 具有支持 XML 文件的扩展。 InstallShield 有一个附加扩展,支持“文本文件更改”以及所谓的替换集。 (查找内容、替换为、仅匹配整个单词、匹配大小写、仅替换一次)我认为它不支持正则表达式。

因此,除非您要切换到 InstallShield,否则您将必须编写自定义操作或将文本文件重构为 XML。

Windows Installer has built-in support for INI files and WiX / InstallShield has extensions for supporting XML files. InstallShield has an additional extension that supports "Text File Changes" with what they call Replacement Sets. ( Find What, Replace With, Match Whole Word Only, Match Case, Replace Once Only ) I don't think it supports RegEx.

So unless you are going to switch to InstallShield you are going to have to write a custom action or refactor the text file to be XML.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文