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. Where is my settings variables saved ?

Where is my settings variables saved ?

Scheduled Pinned Locked Moved C#
helpcsharpxmlquestionworkspace
5 Posts 3 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.
  • N Offline
    N Offline
    Nadia Monalisa
    wrote on last edited by
    #1

    Hi, I have created some settings file other than the main Settings.settings within my C# Win project. Before I used to see that, all new varaibles of all other settings files are being saved in the app.config file as an serializable XML. But in the past few days, I faced a problem with Configuration manager and I used to get error message "Configuration manager failed to load". After hassling for a while I found that, once I changed my project folder's name, the "Configuration manager error gone." but Now, I dont see the new variables in the app.config file any more. yet the settings vars are being saved in my computer somehow somewhere... I dont have any idea where are they being saved. I am worrid thinking that, if I ship my software to my client's pc, will it work in the same way by saving the settings variable somewhere in the PC without saving in app.config ? Thanks and regards Emran

    C O 2 Replies Last reply
    0
    • N Nadia Monalisa

      Hi, I have created some settings file other than the main Settings.settings within my C# Win project. Before I used to see that, all new varaibles of all other settings files are being saved in the app.config file as an serializable XML. But in the past few days, I faced a problem with Configuration manager and I used to get error message "Configuration manager failed to load". After hassling for a while I found that, once I changed my project folder's name, the "Configuration manager error gone." but Now, I dont see the new variables in the app.config file any more. yet the settings vars are being saved in my computer somehow somewhere... I dont have any idea where are they being saved. I am worrid thinking that, if I ship my software to my client's pc, will it work in the same way by saving the settings variable somewhere in the PC without saving in app.config ? Thanks and regards Emran

      C Offline
      C Offline
      Chals
      wrote on last edited by
      #2

      Each project has a different settings file, make sure you are looking into the right one. Other than that, as you already know, settings are always stored as XML, cant think of any other place they are stored in. Hope that helps :)

      1 Reply Last reply
      0
      • N Nadia Monalisa

        Hi, I have created some settings file other than the main Settings.settings within my C# Win project. Before I used to see that, all new varaibles of all other settings files are being saved in the app.config file as an serializable XML. But in the past few days, I faced a problem with Configuration manager and I used to get error message "Configuration manager failed to load". After hassling for a while I found that, once I changed my project folder's name, the "Configuration manager error gone." but Now, I dont see the new variables in the app.config file any more. yet the settings vars are being saved in my computer somehow somewhere... I dont have any idea where are they being saved. I am worrid thinking that, if I ship my software to my client's pc, will it work in the same way by saving the settings variable somewhere in the PC without saving in app.config ? Thanks and regards Emran

        O Offline
        O Offline
        Oleg A Lukin
        wrote on last edited by
        #3

        Application setting persistence is thorougly described in "Application Settings Architecture" MSDN article (http://msdn2.microsoft.com/en-us/library/8eyb2ct1(VS.80).aspx), though, to say in short, they are stored in two parts: application-scope settings are stored in app.exe.config file that should be in the application folder, user-scope settings are stored in local user profile %InstallRoot%\Documents and Settings\username\Local Settings\Application data\CompanyName\ProductName\ProductVersion. The key thing is that this storage depends not only on product-name but on product build either. So, if you will leave apllication build number as it is set by default (1.0.*) or will change build number yourself location will change after build and your settings will be lost because they automatically migrate only when you use ClickOnce application deployment. Therefore you have to create your own settings migration mechanism or your own custom provider for settings storage to control your settings completely.

        N 1 Reply Last reply
        0
        • O Oleg A Lukin

          Application setting persistence is thorougly described in "Application Settings Architecture" MSDN article (http://msdn2.microsoft.com/en-us/library/8eyb2ct1(VS.80).aspx), though, to say in short, they are stored in two parts: application-scope settings are stored in app.exe.config file that should be in the application folder, user-scope settings are stored in local user profile %InstallRoot%\Documents and Settings\username\Local Settings\Application data\CompanyName\ProductName\ProductVersion. The key thing is that this storage depends not only on product-name but on product build either. So, if you will leave apllication build number as it is set by default (1.0.*) or will change build number yourself location will change after build and your settings will be lost because they automatically migrate only when you use ClickOnce application deployment. Therefore you have to create your own settings migration mechanism or your own custom provider for settings storage to control your settings completely.

          N Offline
          N Offline
          Nadia Monalisa
          wrote on last edited by
          #4

          Hi, Thanks for your reply. I have gone thru the article you provided (MSDN) and I realized that the User Scope application settings are stored in the User's profile path returned by System.Windows.Forms.Application.LocalUserAppDataPath. Now, it will be an issue to pack this item into a single installer as I am not using "click Once", how can I instruct my application to load and save user scoped settings.config file in the same Application.StartupPath ? Regards emran

          O 1 Reply Last reply
          0
          • N Nadia Monalisa

            Hi, Thanks for your reply. I have gone thru the article you provided (MSDN) and I realized that the User Scope application settings are stored in the User's profile path returned by System.Windows.Forms.Application.LocalUserAppDataPath. Now, it will be an issue to pack this item into a single installer as I am not using "click Once", how can I instruct my application to load and save user scoped settings.config file in the same Application.StartupPath ? Regards emran

            O Offline
            O Offline
            Oleg A Lukin
            wrote on last edited by
            #5

            Well, I'm afraid I cannot be much help to you. I can say that LocalFileSettingsProvider is a bit of a tough job after I looked through its source. It can be reproduced of course but there is a hell lot of work to do. To be honest I use standard application settings only for a small stuff like window positions - even if they are lost it doesn't make much trouble and can be replaced by reasonable defaults. As for serious things, global settings that persist from version to version and all that I use the same strategy as with common data files - I simply choose the convenient location and put my settings there using simple Dictionary object to store them and serialize/deserialize manually with somthing like SoapFormatter. After all ApplicationSettingsBase is a simple dictionary wrapper too. Regards, Oleg.

            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