Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. move App.Config to AppData folder

move App.Config to AppData folder

Scheduled Pinned Locked Moved C#
question
4 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    Jassim Rahma
    wrote on last edited by
    #1

    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?

    L P C 3 Replies Last reply
    0
    • J Jassim Rahma

      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?

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      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:

      1 Reply Last reply
      0
      • J Jassim Rahma

        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?

        P Offline
        P Offline
        PIEBALDconsult
        wrote on last edited by
        #3

        I never use App.Config; I always roll my own in AppData.

        1 Reply Last reply
        0
        • J Jassim Rahma

          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?

          C Offline
          C Offline
          Cracked Down
          wrote on last edited by
          #4

          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

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups