我在安装时使用wix IniFile元素编辑ini文件。当我尝试卸载时,我得到错误2343:
Начало действия 12:37:47: RemoveIniValues.
MSI (s) (7C:BC) [12:37:47:264]: Note: 1: 2343
DEBUG: Error 2343: Specified path is empty.
我的编辑内容如下:
<?xml version="1.0"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Fragment>
<Property Id="miktex_config_path" Hidden="yes"/>
<SetProperty Id="miktex_config_path" Value="[INSTALLLOCATION]miktex\miktex\config" After="InstallFiles" Sequence="execute">Not Installed</SetProperty>
<DirectoryRef Id="dirC060208F28327102C690BFF33C18B6C4">
<Component Id="miktex_config_file" Guid="4B9400C2-7EEF-4233-881D-5DFE6F80BB5B">
<CreateFolder />
<IniFile Directory="miktex_config_path" Id="common_install_path" Name="miktexstartup.ini" Action="addLine" Key="CommonInstall" Value="[INSTALLLOCATION]miktex" Section="Paths"/>
<IniFile Directory="miktex_config_path" Id="common_data_path" Name="miktexstartup.ini" Action="addLine" Key="CommonData" Value="[CommonAppDataFolder]miktex_data" Section="Paths"/>
<Condition><![CDATA[Not Installed]]></Condition>
</Component>
</DirectoryRef>
</Fragment>
</Wix>
为什么卸载程序不考虑我的条件元素?
如何在卸载期间强制安装程序忽略ini文件编辑?
答案 0 :(得分:0)
条件是针对组件的,但正在运行的操作是RemoveIniValue。您可以通过覆盖InstallExecuteSequence来压制此操作,如下所示:
<InstallExecuteSequence>
<RemoveIniValues Suppress="yes" />
</InstallExecuteSequence>
答案 1 :(得分:0)
这取决于你所追求的任务。如果你需要完全阻止INI值的删除,那么按照David Martin的建议去除InstallExecuteSequence中的RemoveIniValues就是这样。然而,这种抑制(无论你把它作为条件放在哪里),会阻止INI入口移除以及安装和卸载(再次,条件不起作用,甚至不试图将条件设置为仅在卸载时禁止)。但是,如果您需要在安装期间允许INI输入/标记删除(带有删除操作的IniFile声明),但同时您需要在卸载期间阻止其他INI设置被删除,那么只需在您保留的位置标记组件您的IniFile声明为Permanent =&#34; yes&#34;。在这种情况下,您的INI设置将不会在卸载时删除,并且您在安装时删除特定INI设置的声明将起作用,并且完全忘记RemoveIniValues抑制。