我用MS WiX创建的安装程序将组件(某些文件)安装到用户的App Data目录中的现有文件夹中。此现有文件夹为空。因此,在卸载时,安装程序将删除此文件夹-不应这样做。 那么如何预防呢?
代码是:
<Fragment>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="LocalAppDataFolder" Name="AppData">
<Directory Id="OtherCompanysFolder" Name="OtherCompany">
<Directory Id="OtherProductsFolder" Name="Product">
<Directory Id="AddOnsFolder" Name="AddOns">
<Directory Id="MyAddOnFolder" Name="MyAddOn">
</Directory>
</Directory>
</Directory>
</Directory>
</Directory>
</Directory>
</Fragment>
<Fragment Id="AddOnFiles">
<ComponentGroup Id="ProductComponents" Directory="MyAddOn">
<Component Id="ProductComponent" Guid="{xxx}">
<RegistryKey Root="HKCU" Key="Software\$(var.Manufacturer)\$(var.Product)">
<RegistryValue Type="string" Value="" KeyPath="yes" />
</RegistryKey>
<RemoveFolder Id="RemoveMyAddOnFolder" On="uninstall" Directory="MyAddOnFolder" />
<RemoveFolder Id="RemoveAddOnsFolder" On="uninstall" Directory="AddOnsFolder" />
<RemoveFolder Id="RemoveOtherProductsFolder" On="uninstall" Directory="OtherProductsFolder" />
<RemoveFolder Id="RemoveOtherCompanysFolder" On="uninstall" Directory="OtherCompany" />
<File Id="Executable" Source="path\to\My.exe" />
</Component>
</ComponentGroup>
</Fragment>
问题是,如果我删除节点
<RemoveFolder Id="RemoveAddOnsFolder" On="uninstall" Directory="AddOnsFolder" />
<RemoveFolder Id="RemoveOtherProductsFolder" On="uninstall" Directory="OtherProductsFolder" />
<RemoveFolder Id="RemoveOtherCompanysFolder" On="uninstall" Directory="OtherCompany" />
光与冰会抱怨:
错误LGHT0204:ICE64:目录AddOnsFolder在用户配置文件中,但未在RemoveFile表中列出。
保留这些节点会使Light and Ice很高兴,但是它将删除AddOnsFolder(不应该这样做)。
有什么想法我能做什么?
PS:在注释部分,建议使用标志(-sice:ICE64)禁止显示错误消息。这不是解决方案。现在,在安装程序编译时,仍然会删除AddOn文件夹(一定不能发生)