【发布时间】:2014-05-19 23:44:46
【问题描述】:
我正在尝试配置继承的 WiX 安装程序以用于我的软件。
软件记录到 C:\SomePath\LogFiles 中特定日期的文件,例如 2014-05-19.txt、2014-05-18.txt 等(与问题无关,但可能值得注意的是将存在由软件创建的文件,而不是由安装程序本身创建的文件)。
我的 WiX 安装程序会像这样创建 LogFiles 目录(为了便于阅读,删除了许多元素、GUID 等):
<Wix>
<Product Id="SOME_GUID" Version="SOME_VERSION" UpgradeCode="OTHER_GUID">
<Feature Id="EMPTY_DIRECTORIES" Title="Empty Directories" Level="1" Display="hidden">
<ComponentRef Id="SomeFolder" />
<ComponentRef Id="LogFiles" />
<ComponentRef Id="SomeOtherFolder" />
</Feature>
<DirectoryRef Id="DIR_LOG_FILES">
<Component Guid="" Id="DELETE_DIR_LOG_FILES">
<RemoveFile Id="DELETE_DIR_LOG_FILES_FILES" Name="*.*" On="uninstall" />
<RemoveFolder Id="DELETE_DIR_LOG_FILES" On="uninstall" />
</Component>
</DirectoryRef>
</Product>
<Fragment>
<Directory Name="SoftwareName" Id="SOFTWARENAME">
<Directory Id="DIR_LOG_FILES" Name="LogFiles">
<Component Id="LogFiles" KeyPath="no" NeverOverwrite="no" Permanent="no" Win64="no" Location="local">
<CreateFolder>
<util:PermissionEx CreateChild="yes" CreateFile="yes" Delete="yes" Read="yes" ReadAttributes="yes" ReadExtendedAttributes="yes" ReadPermission="yes" Traverse="yes" GenericRead="yes" GenericWrite="yes" User="Everyone" />
</CreateFolder>
</Component>
</Directory>
</Directory>
</Fragment>
<Fragment>
<ComponentGroup Id="LoggingComponents" Directory="WHERE_THE_LOGGING_DLLS_LIVE">
<ComponentRef Id="DELETE_DIR_LOG_FILES" />
</ComponentGroup>
</Fragment>
</Wix>
我曾希望此设置会导致目录和内容仅在卸载时被删除。不幸的是,删除似乎也会在升级时触发。有没有办法配置 WiX 来区分并做出适当的反应?
【问题讨论】:
标签: wix windows-installer