Search code examples
c#winformssettingsapplication-settings

What happens with settings after deleting the executable file?


Let's say I made a program that is without installer (only exe file) and its save some data on settings. What will happen if i delete that exe file? Will the settings delete automatically? If no can you give me some suggestions?


Solution

  • Application settings are stored in a file name <exename>.exe.config near the executable file. For example if your executable is MyApp.exe, the configuration file is MyApp.exe.config. So they are stored in different files.

    If you change a user-level setting (application-level settings are read-only) and save the settings (Settings.Default.Save()), the changed values are stored in a file named user.config in a subfolder in %LOCALAPPDATA% folder (see this answer for more information). So if you delete the application folder, the changed settings are not deleted.