Search code examples
c#.netwpf.net-6.0desktop-bridge

Path for folder that gets deleted when app gets uninstalled (Desktop-Bridge WPF .Net 6)


How do I get the path for a folder that gets deleted when the app gets uninstalled? (For a desktop bridge WPF app with a "packaging project".)

I want to store information there that will be removed if the user uninstalls the app so that if they reinstall it they'll get the experience of a completely new install. Using the TMP folders is not enough, data there can get deleted. It usually does not.

I also can't use ApplicationSettings because those don't play well with the desktop bridge.


Solution

  • Any file that you save to Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) during the execution of a packaged app will be redirected to %localappdata%\Packages\PublisherName.AppName_hash\LocalCache\Local and removed when uninstalling the app.