Leonardo Redmond
Leonardo Redmond

Reputation: 49

I want to delete the files stored in Isolated Storage when the OOB app is removed

I want to delete the files stored in Isolated Storage when the OOB app is removed. How can i delete these files?

Thanks

Upvotes: 4

Views: 1105

Answers (1)

sll
sll

Reputation: 62494

Good question! This article describes how to automate this process whilst an application uninstallation:

The previous code in uses the IsolatedStorageFile.Remove() function to tidy up after itself, but obviously for a real application this is not a sensible approach! However, application developers should consider removing isolated storage when the application is uninstalled. Unfortunately there is no simple way to instruct your installer to do this so it has to be done programmatically in an Installer Class, overriding the Uninstall function:

public override void
    Uninstall(System.Collections.
    IDictionary savedState)
{
    IsolatedStorageFile isf =
        IsolatedStorageFile.GetStore(
        IsolatedStorageScope.Assembly |
        IsolatedStorageScope.User,
        (Type)null,
        (Type)null);
    isf.Remove();
    base.Uninstall(savedState);
}

see Uninstallation section for more details.

EDIT:

As AnthonyWJones mentioned there is difference between Silverlight and Desctop application isolated Storage models, so article I've referenced is not pretty helpful in scope of your question, sorry for that. I've found following SO post which saying that files still remain and user could delete them himself, I'm not sure whether an other option exists, will let you know if found anything.

SO Post: Isolated Storage, OOB, and Removing the App

Upvotes: 3

Related Questions