Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WiX RemoveFolderEx not working?

I wanted WiX to remove the AppData folder when uninstalling, so I looked at RemoveFolderEx and followed a few posts/guides on how to get it working. As far as i can tell, my implementation should work, but it does not. I'm using the following:

<Directory Id="TARGETDIR" Name="SourceDir">
    <Directory Id="AppDataFolder">
        <Directory Id="PRIVATEDATAFOLDER" Name="MyApp"/>
    </Directory>
</Directory>
<Property Id="PRIVATEDATAFOLDER">
    <RegistrySearch Root="HKCU" Key="Software\AppCo\MyApp" Type="raw" 
                    Id="APPLICATIONFOLDER_REGSEARCH" Name="PrivateDir" />
</Property>
<DirectoryRef Id='PRIVATEDATAFOLDER'>
    <Component Id="PrivateData" Guid="myGuid">
        <CreateFolder Directory="PRIVATEDATAFOLDER"/>
        <util:RemoveFolderEx Property="PRIVATEDATAFOLDER" On="uninstall"/>
        <RemoveFolder Id="PRIVATEDATAFOLDER" On="uninstall"/>
        <RegistryValue Root="HKCU" Key="Software\AppCo\MyApp" Name="PrivateDir" 
                       Type="string" Value="[PRIVATEDATAFOLDER]" KeyPath="yes"/>
    </Component>
</DirectoryRef>

Is there something I'm doing wrong here?

EDIT: After checking a verbose log I get the error:

WixRemoveFoldersEx: Error 0x80070057: Missing folder property: PRIVATEDATAFOLDER

like image 663
BoyUnderTheMoon Avatar asked Jul 29 '14 08:07

BoyUnderTheMoon


2 Answers

In your logs, above the 'Error 0x80070057: Missing folder property: PRIVATEDATAFOLDER' is there a log line such as 'Ignoring disallowed property PRIVATEDATAFOLDER' and if so, have you tried adding 'secure="yes"' to your PRIVATEDATAFOLDER property?

like image 72
Wahooiy Avatar answered Oct 26 '22 10:10

Wahooiy


Use a different Id for the Property than the Directory. They're clashing, which causes the property to be empty when RemovedFoldersEx tries to process it.

like image 36
Bob Arnson Avatar answered Oct 26 '22 09:10

Bob Arnson