0

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?

a1204773
  • 6,923
  • 20
  • 64
  • 94
  • No,and there are 2 locations for for settings, depending if they are app or user level settings. – leppie Mar 04 '13 at 11:01
  • The settings file will not be deleted. If you want this to happen you'll need an installer and an uninstaller. The uninstaller can remove the files you want to be deleted. – Abbas Mar 04 '13 at 11:01

3 Answers3

1

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.

Community
  • 1
  • 1
Mohammad Dehghan
  • 17,853
  • 3
  • 55
  • 72
  • if I put the exe file and the config file in one folder and send it to someone will it save the settings in that config or it will make somewhere else? I want to know if he can delete that folder so the settings to be deleted too. – a1204773 Mar 04 '13 at 11:07
1

No, settings won't be removed if you just delete the EXE. Settings also will not be removed by an MSI if they have been modified since the program was installed. A custom action would allow you to remove the file during uninstallation however.

Simon
  • 8,981
  • 2
  • 26
  • 32
0

No, it won't.

The settings are stored in a separate file.
The best way is to make an installer/uninstaller.

BenMorel
  • 34,448
  • 50
  • 182
  • 322
giammin
  • 18,620
  • 8
  • 71
  • 89