[wix-users] How to conditionally remove configuration?
Markus Kramer
markuskramerigitt at gmail.com
Wed May 13 08:44:46 PDT 2020
Greetings,
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,
Markus
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product
Name='Foobar 1.0'
UpgradeCode='053437f1-994d-4758-be0e-99ccf6d89618'
Id='*'
Language='1033'
Version='1.0.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'/>
</Component>
</Directory>
<Directory Id='CONFIGFOLDER' Name='FoobarConf'>
<Component Id="RmConfComponent" Transitive='yes'
Guid="b0244929-7cdd-4f5d-9a49-c8672382747d">
<!-- The commandline property REMOVE_CONFIG=1 has no effect
on RemoveFile
Maybe because msi schedules properties after Remove Files?
Transitive='yes' added because of
https://stackoverflow.com/questions/16037821/why-are-properties-ignored-on-uninstallation-if-they-have-not-been-set-on-insta
-->
<Condition>REMOVE_CONFIG=1</Condition>
<CreateFolder />
<RemoveFile Name="*.*" On="uninstall" Id="RmConfig"/>
<RemoveFolder Id="CONFIGFOLDER" On="uninstall"/>
</Component>
</Directory>
</Directory>
</Directory>
</Directory>
<Feature Id='Complete'>
<ComponentRef Id='MainExecutable'/>
<ComponentRef Id='RmConfComponent'/>
</Feature>
</Product>
</Wix>
On Tue, May 12, 2020 at 5:19 PM Markus Kramer <markuskramerigitt at gmail.com>
wrote:
> 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