[wix-users] How to conditionally remove configuration?

Markus Kramer markuskramerigitt at gmail.com
Wed May 13 08:44:46 PDT 2020

sadly, I am unable to use RemoveFile conditionally in the wxs file below.
Is REMOVE_CONFIG not yet present when RemoveFile is scheduled?

Thank you,

<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
      Name='Foobar 1.0'
      Manufacturer='Acme Ltd.'
    <Package InstallerVersion='450' Compressed='yes'
InstallScope="perMachine" />
    <MediaTemplate EmbedCab="yes" />
    <!-- With SetProperty, the commandline property REMOVE_CONFIG=1 has no
effect   -->
    <!-- <SetProperty Id="REMOVE_CONFIG" Value="0"
Before="CostInitialize"/> -->
    <Directory Id='TARGETDIR' Name='SourceDir'>
      <Directory Id='ProgramFilesFolder' Name='PFiles'>
        <Directory Id='Acme' Name='Acme'>
          <Directory Id='INSTALLFOLDER' Name='FoobarBin'>
            <Component Id='MainExecutable'>
              <File Id='FoobarEXE' Name='FoobarAppl10.exe'
Source='FoobarAppl10.exe' KeyPath='yes'/>
          <Directory Id='CONFIGFOLDER' Name='FoobarConf'>
            <Component Id="RmConfComponent" Transitive='yes'
              <!-- The commandline property REMOVE_CONFIG=1 has no effect
on RemoveFile
              Maybe because msi schedules properties after Remove Files?
              Transitive='yes'  added because of

              <CreateFolder />
              <RemoveFile Name="*.*" On="uninstall" Id="RmConfig"/>
              <RemoveFolder Id="CONFIGFOLDER" On="uninstall"/>
    <Feature Id='Complete'>
      <ComponentRef Id='MainExecutable'/>
      <ComponentRef Id='RmConfComponent'/>

On Tue, May 12, 2020 at 5:19 PM Markus Kramer <markuskramerigitt at gmail.com>

> Greetings,
> I use custom actions to remove configuration on uninstall, depending on an
> property (REMOVE_CONFIG)
> I would like to replace my custom actions with RemoveFolderEx but
> RemoveFolderEx is called so early, that there are no properties yet.
> How could you make  RemoveFolderEx depend on a user property?
> E.g. could I call  RemoveFolderEx from my custom action?
> Can  RemoveFolder (without Ex)  depend on a user property?
> Is there a best practice for configuration data?
> Thank you,
> Markus
> P.S. I tried to search the mail archive but was unable to use the
> search function.

More information about the wix-users mailing list