Luke
Luke

Reputation: 6315

How can I remove .NET isolated storage setting folders during WiX uninstallation?

I would like to remove the isolated storage folders that are created by a .NET application when using My.Settings etc. The setting files are stored in a location like

C:\Users\%Username%\AppData\Roaming\App\App.exe_Url_r0q1rvlnrqsgjkcosowa0vckbjarici4

As per this question StackOverflow: Removing files when uninstalling Wix I can uninstall a folder using:

<Directory Id="AppDataFolder" Name="AppDataFolder"> 
    <Directory Id="MyAppFolder" Name="My"> 
        <Component Id="MyAppFolder" Guid="YOURGUID-7A34-4085-A8B0-8B7051905B24"> 
            <CreateFolder />
            <RemoveFile Id="PurgeAppFolder" Name="*.*" On="uninstall" /> 
        </Component> 
    </Directory> 
</Directory>

<!-- LocalAppDataFolder-->

This doesn't support sub-folders etc. Is the only option a custom .NET action or is there a more simple approach for removing these .NET generated setting folders?

Upvotes: 3

Views: 571

Answers (2)

Luke
Luke

Reputation: 6315

If anyone is experiencing the same issue, I used a custom .NET action to remove the folders. The WiX documentation provided a good example on how to create the action.

Upvotes: 0

Yan Sklyarenko
Yan Sklyarenko

Reputation: 32270

Yep, if you don't know the folders at build time to fill in the RemoveFile table entirely, then you have to create a custom action.

You might also find the WixContrib project useful. It contains RemoveFolderEx extension to address this very problem. As it states, the code is of medium production quality. Never tried it myself, though...

Upvotes: 3

Related Questions