Question

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

Was it helpful?

Solution

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?

OTHER TIPS

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top