move App.Config to AppData folder
-
Hi, Why the App.Config is usually copied in the application folder in Program Files? any technical reason? Is it advisable to move it to the AppData folder?
-
Hi, Why the App.Config is usually copied in the application folder in Program Files? any technical reason? Is it advisable to move it to the AppData folder?
jrahma wrote:
Why the App.Config is usually copied in the application folder in Program Files? any technical reason?
Is it advisable to move it to the AppData folder?A logical reason; it's a configuration at application level. The documentation on the
[SpecialFolder](http://msdn.microsoft.com/en-us/library/system.environment.specialfolder.aspx)[[^](http://msdn.microsoft.com/en-us/library/system.environment.specialfolder.aspx "New Window")]
enum contains explanation on what the different folders are used for.Bastard Programmer from Hell :suss:
-
Hi, Why the App.Config is usually copied in the application folder in Program Files? any technical reason? Is it advisable to move it to the AppData folder?
I never use App.Config; I always roll my own in AppData.
-
Hi, Why the App.Config is usually copied in the application folder in Program Files? any technical reason? Is it advisable to move it to the AppData folder?
you should not move application configuration file to AppData. Reason : App.config file is configuration for the application as its name suggest but at the time of deployment. You should not touch this file once the application is installed. The reason why this file is copied to the installation folder is same as that of all the exes and dlls that you deploy. which are not editable or undergo any changes unless a new version is installed. Installation folder : is a base image of your application App Data Folder : is deployment/user specific and can be altered at any time. Generally, administrator has a rights to change the installation folder. A normal user can not change any files within it. Problem arises when you give control to user over this installation directory. Think if this config file is tempered by the user. Config files are automatically loaded by the application and hence result in application crash where as, appData folder can be loaded and validated by the code. I am not sure why you want to do this but, I am guessing you want some of the settings to be altered at the run time. If that is the case then there is option for doing this in the visual studio. There are two types of the settings Application & User, user use setting for this case Hope this helps :-D Happy Coding