Click here to Skip to main content
15,889,034 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a WPF application that makes use of the Settings mechanism. Each time I deploy a version of my application, I notice I get a new folder for the version. These folders look something like this:

C:\Users\(username)\AppData\Local\Company_Name\MyApplication.WPF.exe_Url_1vtxeuikkx5nbggwlqbrhxrkiruybflb\0.4.27.0
C:\Users\(username)\AppData\Local\Company_Name\MyApplication.WPF.exe_Url_1vtxeuikkx5nbggwlqbrhxrkiruybflb\0.4.28.0
C:\Users\(username)\AppData\Local\Company_Name\MyApplication.WPF.exe_Url_1vtxeuikkx5nbggwlqbrhxrkiruybflb\0.4.29.0


While I realise that these folders are small, I would like to be able to remove old versions of the user settings, as these will never be needed again. Ideally, I would like to remove the entire folder. Is there a way to achieve this?

What I have tried:

So far I haven't tried anything because I can't think of anything to try.

I was considering trying a brute-force approach, by getting the folder where the application stores its data and using the functions in System.IO to manually clean-up.
Posted
Comments
ZurdoDev 18-Feb-18 21:48pm    
I don't know but I would guess writing code is your best option. Unless you are creating a package install and some installers have an option to remove previous versions.
Patrick Skelton 5-May-18 3:36am    
I ended up simply bypassing the Microsoft settings system. I know rolling your own solution is often considered bad-form but it so often seems to be the case that out-of-the-box solutions don't work the way you want and are not easy to modify. I even ended up writing a load of code to modify the functionality of the wonderful NLog recently because it simply would not do what I needed it to do.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900