[wix-users] How to conditionally remove configuration?
Hoover, Jacob
Jacob.Hoover at greenheck.com
Wed May 13 12:46:20 PDT 2020
You need to define the property as a secure custom property.
Without detailed logs, now all I am doing is guessing as to why you are having issues. It’s obviously detected the component, and it sees that it wants to uninstall, but something is changing that to Null.
What happens if you define the property as secure, have it named in all upper case, change your Guid on the component to *, and install and uninstall?
From: Markus Kramer [mailto:markuskramerigitt at gmail.com]
Sent: Wednesday, May 13, 2020 12:55 PM
To: Hoover, Jacob <Jacob.Hoover at greenheck.com>
Subject: Re: [wix-users] How to conditionally remove configuration?
Hello Jacob,
thank you for the URL!
With the custom actions from the blog, the PROPERTY CHANGE of REMOVE_CONFIG=1 happens earlier than RemoveFile component evaluation.
Unfortunately, the component is evaluated to the Null action and therefore RemoveFile is not called.
Component: RmConfComponent; Installed: Local; Request: Absent; Action: Null
After removing Transient='yes' or using a new GUID the action is still Null.
Could you help me out with this, too?
Thank you,
Markus
On Wed, May 13, 2020 at 5:53 PM Hoover, Jacob <Jacob.Hoover at greenheck.com<mailto:Jacob.Hoover at greenheck.com>> wrote:
http://robmensching.com/blog/posts/2010/5/2/the-wix-toolsets-remember-property-pattern/<http://robmensching.com/blog/posts/2010/5/2/the-wix-toolsets-remember-property-pattern/>
From: wix-users [mailto:wix-users-bounces at lists.wixtoolset.org<mailto:wix-users-bounces at lists.wixtoolset.org>] On Behalf Of Markus Kramer via wix-users
Sent: Wednesday, May 13, 2020 10:45 AM
To: wix-users at lists.wixtoolset.org<mailto:wix-users at lists.wixtoolset.org>
Cc: Markus Kramer <markuskramerigitt at gmail.com<mailto:markuskramerigitt at gmail.com>>
Subject: Re: [wix-users] How to conditionally remove configuration?
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<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<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<mailto: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.
>
>
____________________________________________________________________
WiX Toolset Users Mailing List provided by FireGiant http://www.firegiant.com/<http://www.firegiant.com>
NOTE: This email was received from an external source. Please use caution when opening links or attachments in the message.
NOTE: This email was received from an external source. Please use caution when opening links or attachments in the message.
More information about the wix-users
mailing list