CodeGuru Forums -
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic Newsletters VB Forums Developer.com


Newest CodeGuru.com Articles:

  • Deploying Windows Server 2008 with System Center
  • Remote Desktop Protocol Performance Improvements in Windows Server 2008 R2 and Windows 7
  • The Microsoft Dynamics CRM Security Model
  • SQL Server Modeling Services with Microsoft Visual Studio 2010 Beta 2

  • Search CodeGuru:
     



    Go Back   CodeGuru Forums > .NET Programming > C-Sharp Programming
    FAQ Members List Calendar Search Today's Posts Mark Forums Read

    C-Sharp Programming Post questions, answers, and comments about C#.

    Reply
     
    Thread Tools Search this Thread Rate Thread Display Modes
      #1    
    Old September 3rd, 2009, 05:37 AM
    memeloo memeloo is online now
    Member +
     
    Join Date: Oct 2008
    Location: Cologne, Germany
    Posts: 528
    memeloo is a jewel in the rough (200+) memeloo is a jewel in the rough (200+) memeloo is a jewel in the rough (200+)
    settings.settings == app.config ??

    there are some texts around that say setting files are better then app.config. but this seems not to be the truth. I've just created one settings file and everything I wrote in the designer was saved in the app.config files. so this is not a big advantage after all. it's only some kind of a wrapper for the app.config.
    __________________
    win7 x86, VS 2008, C++/CLI, C#, .NET 3.5, VB.NET, VBA

    remeber to give feedback and if you think my response deserves recognition perhaps you may want to click the Rate this post link/button
    Reply With Quote
      #2    
    Old September 3rd, 2009, 07:03 AM
    boudino's Avatar
    boudino boudino is offline
    Senior Member
     
    Join Date: Mar 2004
    Location: Prague, Czech Republic, EU
    Posts: 1,469
    boudino is a splendid one to behold (750+) boudino is a splendid one to behold (750+) boudino is a splendid one to behold (750+) boudino is a splendid one to behold (750+) boudino is a splendid one to behold (750+) boudino is a splendid one to behold (750+) boudino is a splendid one to behold (750+) boudino is a splendid one to behold (750+)
    Re: settings.settings == app.config ??

    Just wrapper, but usefull, because it is strongly typed and you can access the config values trought properties instead generic string keys.
    __________________
    • Make it run.
    • Make it right.
    • Make it fast.
    Don't hesitate to rate my post.
    Reply With Quote
      #3    
    Old September 3rd, 2009, 09:37 AM
    eclipsed4utoo eclipsed4utoo is offline
    Member +
     
    Join Date: Nov 2007
    Location: .NET 3.5 / VS2008 Developer
    Posts: 538
    eclipsed4utoo is a jewel in the rough (200+) eclipsed4utoo is a jewel in the rough (200+) eclipsed4utoo is a jewel in the rough (200+)
    Re: settings.settings == app.config ??

    If you are referring to the "Properties.Settings.Default", this is completely different from the app.config file. They are stored in two completely different places.

    One downside of using the Properties.Settings.Default is that the file is specific for the assembly version. So if you change your assembly version, then it uses a different file and you lose any settings that were saved for the previous assembly version. Though there are ways to get around this.
    Reply With Quote
      #4    
    Old September 3rd, 2009, 11:48 AM
    memeloo memeloo is online now
    Member +
     
    Join Date: Oct 2008
    Location: Cologne, Germany
    Posts: 528
    memeloo is a jewel in the rough (200+) memeloo is a jewel in the rough (200+) memeloo is a jewel in the rough (200+)
    Re: settings.settings == app.config ??

    Quote:
    Originally Posted by eclipsed4utoo View Post
    If you are referring to the "Properties.Settings.Default", this is completely different from the app.config file. They are stored in two completely different places.
    could you tell me where?
    Quote:
    Originally Posted by eclipsed4utoo View Post
    One downside of using the Properties.Settings.Default is that the file is specific for the assembly version. So if you change your assembly version, then it uses a different file and you lose any settings that were saved for the previous assembly version. Though there are ways to get around this.
    I've got exacly this proplem in my app. I'd appriciate some clues how to get around this.
    __________________
    win7 x86, VS 2008, C++/CLI, C#, .NET 3.5, VB.NET, VBA

    remeber to give feedback and if you think my response deserves recognition perhaps you may want to click the Rate this post link/button
    Reply With Quote
      #5    
    Old September 3rd, 2009, 12:32 PM
    Arjay's Avatar
    Arjay Arjay is offline
    Moderator / MS MVP
    Power Poster
     
    Join Date: Aug 2004
    Posts: 6,914
    Arjay has a reputation beyond repute (3000+) Arjay has a reputation beyond repute (3000+) Arjay has a reputation beyond repute (3000+) Arjay has a reputation beyond repute (3000+) Arjay has a reputation beyond repute (3000+) Arjay has a reputation beyond repute (3000+) Arjay has a reputation beyond repute (3000+) Arjay has a reputation beyond repute (3000+) Arjay has a reputation beyond repute (3000+) Arjay has a reputation beyond repute (3000+) Arjay has a reputation beyond repute (3000+)
    Re: settings.settings == app.config ??

    See Application.LocalUserAppDataPath

    &

    http://msdn.microsoft.com/en-us/library/0zszyc6e.aspx

    Last edited by Arjay; September 3rd, 2009 at 12:38 PM.
    Reply With Quote
      #6    
    Old September 3rd, 2009, 01:00 PM
    BigEd781 BigEd781 is offline
    Senior Member
     
    Join Date: Jun 2008
    Posts: 1,194
    BigEd781 is a glorious beacon of light (400+) BigEd781 is a glorious beacon of light (400+) BigEd781 is a glorious beacon of light (400+) BigEd781 is a glorious beacon of light (400+) BigEd781 is a glorious beacon of light (400+) BigEd781 is a glorious beacon of light (400+)
    Re: settings.settings == app.config ??

    As an aside, I have encountered problems using the built in settings file. It seems that if the file is missing an exception will be thrown before main() is entered. I had to write my own settings class to avoid this.
    Reply With Quote
      #7    
    Old September 3rd, 2009, 01:17 PM
    eclipsed4utoo eclipsed4utoo is offline
    Member +
     
    Join Date: Nov 2007
    Location: .NET 3.5 / VS2008 Developer
    Posts: 538
    eclipsed4utoo is a jewel in the rough (200+) eclipsed4utoo is a jewel in the rough (200+) eclipsed4utoo is a jewel in the rough (200+)
    Re: settings.settings == app.config ??

    the physical path is:

    C:\Documents and Settings\[username]\Local Settings\Application Data\[AssemblyCompanyName]\[NameOfProject].[SomeLongUniqueString]\[AssemblyVersion]\user.config

    that's in XP.
    Reply With Quote
      #8    
    Old September 7th, 2009, 05:51 AM
    memeloo memeloo is online now
    Member +
     
    Join Date: Oct 2008
    Location: Cologne, Germany
    Posts: 528
    memeloo is a jewel in the rough (200+) memeloo is a jewel in the rough (200+) memeloo is a jewel in the rough (200+)
    Re: settings.settings == app.config ??

    ok, now I know where each file is stored and I read the msdn-pages about settings but I didn't find how to prevent a new version of my app to overwrite the old settings.
    __________________
    win7 x86, VS 2008, C++/CLI, C#, .NET 3.5, VB.NET, VBA

    remeber to give feedback and if you think my response deserves recognition perhaps you may want to click the Rate this post link/button
    Reply With Quote
      #9    
    Old September 8th, 2009, 08:06 AM
    eclipsed4utoo eclipsed4utoo is offline
    Member +
     
    Join Date: Nov 2007
    Location: .NET 3.5 / VS2008 Developer
    Posts: 538
    eclipsed4utoo is a jewel in the rough (200+) eclipsed4utoo is a jewel in the rough (200+) eclipsed4utoo is a jewel in the rough (200+)
    Re: settings.settings == app.config ??

    when you change the assembly version of your application, it does NOT overwrite the old settings. If you notice in the path that I posted, the last directory is the Assembly Version. If you change the assembly version, the app will create a new folder and a new file, and begin using that file. That's how you "lose" your old settings. The old file is still there, it's just in a different directory from where the application is looking for the "user.config" file.
    Reply With Quote
    Reply

    Bookmarks
    Go Back   CodeGuru Forums > .NET Programming > C-Sharp Programming


    Thread Tools Search this Thread
    Search this Thread:

    Advanced Search
    Display Modes Rate This Thread
    Rate This Thread:

    Posting Rules
    You may not post new threads
    You may not post replies
    You may not post attachments
    You may not edit your posts

    BB code is On
    Smilies are On
    [IMG] code is On
    HTML code is Off
    Forum Jump


    All times are GMT -5. The time now is 01:57 PM.



    Acceptable Use Policy


    The Network for Technology Professionals

    Search:

    About Internet.com

    Legal Notices, Licensing, Permissions, Privacy Policy.
    Advertise | Newsletters | E-mail Offers


    Powered by vBulletin® Version 3.7.3
    Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.