【问题标题】:Only remove a folder on uninstall, not upgrade仅在卸载时删除文件夹,而不是升级
【发布时间】: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


    【解决方案1】:

    在您的构建过程中,您是否更新了您想要生成的 dll 版本,因为这应该会覆盖它。您是否有任何删除文件/文件夹标签,因为它们也可能导致问题。

    【讨论】:

    • 是的,DLL 版本已更新。但是 DLL 无处不在。如上所示,我有 RemoveFile 和 RemoveFolder,On 属性设置为“卸载”
    猜你喜欢
    • 2011-03-18
    • 1970-01-01
    • 2011-01-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-02-16
    • 2011-06-18
    • 2011-11-23
    相关资源
    最近更新 更多