[wix-users] RemoveFolderEx and disabled components

Bob Arnson bob at firegiant.com
Thu Oct 18 18:36:41 PDT 2018


The design was that it should log and continue. And as the components propagate to the generated rows, there's minimal value in checking the component state first.

-----Original Message-----
From: wix-users <wix-users-bounces at lists.wixtoolset.org> On Behalf Of Rob Mensching via wix-users
Sent: Thursday, 18 October, 2018 21:11
To: WiX Toolset Users Mailing List <wix-users at lists.wixtoolset.org>
Cc: Rob Mensching <rob at firegiant.com>
Subject: Re: [wix-users] RemoveFolderEx and disabled components

The custom action probably shouldn't fail if the folders are already gone but otherwise the custom action is behaving correctly, assigning the rows to a Component.
_____________________________________________________________
 Short replies here. Complete answers over there: http://www.firegiant.com/

-----Original Message-----
From: wix-users <wix-users-bounces at lists.wixtoolset.org> On Behalf Of Paul Shmakov via wix-users
Sent: Thursday, October 18, 2018 4:38 PM
To: wix-users at lists.wixtoolset.org
Cc: Paul Shmakov <paul.shmakov at gmail.com>
Subject: [wix-users] RemoveFolderEx and disabled components

Hello!

WixRemoveFolderEx searches the file system and populates the RemoveFile table even for the disabled components. It's a problem because the path may not exist.

Here's my use case: during the installation I need to delete traces of the previous version of the product that was installed using batch files (not MSI), if it's present.

All the cleaning up is packaged as a Component which has a condition "NOT Installed AND OLDPRODUCTFOUND". The component consists of a bunch of RemoveFile nodes and RemoveFolderEx to delete certain subfolders.

The RemoveFolderEx here makes sense only if the old product is detected (OLDPRODUCTFOUND property). Otherwise there's no meaningful path to search through.

WixRemoveFoldersEx does not check the installation state of the component, nor does it have its own condition. As a result WixRemoveFoldersEx always executes and tries to search the path that does not exist. And fails.

Here's a snippet:
<Property Id="OLDPRODUCTFOUND">
  <DirectorySearch
      Path="[ProgramFilesFolder]\Company\Product X"
      AssignToProperty="yes">
    <FileSearch Name="ProductX.exe"/>
  </DirectorySearch>
</Property>

<SetProperty
    Id="OLDSUBFOLDER"
    Value="[OLDPRODUCTFOUND]\Foo\Bar"
    Before="CostInitialize" />

<Component Id="CleanupOldProduct">
  <Condition>NOT Installed AND OLDPRODUCTFOUND</Condition>
  <util:RemoveFolderEx Property="OLDSUBFOLDER" On="install"/> </Component>

If the old product is not found, WixRemoveFoldersEx tries to enumerate "\Foo\Bar" and fails.

I'd really appreciate if somebody can explain what I'm doing wrong here or point me to a known workaround.
The only solution I can think of is to set the property (OLDSUBFOLDER) to some non-existent folder to let WixRemoveFoldersEx fail gracefully.

Wix 3.11

Thanks in advance,
Paul

____________________________________________________________________
WiX Toolset Users Mailing List provided by FireGiant http://www.firegiant.com/

____________________________________________________________________
WiX Toolset Users Mailing List provided by FireGiant http://www.firegiant.com/


More information about the wix-users mailing list