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. Understanding ConfigurationSettings

Understanding ConfigurationSettings

Scheduled Pinned Locked Moved C#
helpcomdebuggingquestionworkspace
3 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
    Neil Lamka
    wrote on last edited by
    #1

    Ok, so I know I'm missing something very basic here but I am having a problem understanding how ConfigurationSettings work. I've looked at the various examples but still can't get it to work for me. I have a Windows application ... application name testapp. I've created a configuration file named testapp.exe.config and copied the file into (in this case) the bin\debug directory along with the EXE file. The config file looks like the following... copied from one of the examples: In my code I have the following statement. string appName = ConfigurationSettings.AppSettings["Application Name"]; What I get is appName = null and the config file is removed form the debug\bin directory. So, 1st, should the config file be being deleted..if so, are the actual settings stored someplace? and 2nd, what am I missing by not being able to read the value for "Application Name" give the above code and config file. Thanks for the help Neil Lamka neil@meetingworks.com

    A R 2 Replies Last reply
    0
    • N Neil Lamka

      Ok, so I know I'm missing something very basic here but I am having a problem understanding how ConfigurationSettings work. I've looked at the various examples but still can't get it to work for me. I have a Windows application ... application name testapp. I've created a configuration file named testapp.exe.config and copied the file into (in this case) the bin\debug directory along with the EXE file. The config file looks like the following... copied from one of the examples: In my code I have the following statement. string appName = ConfigurationSettings.AppSettings["Application Name"]; What I get is appName = null and the config file is removed form the debug\bin directory. So, 1st, should the config file be being deleted..if so, are the actual settings stored someplace? and 2nd, what am I missing by not being able to read the value for "Application Name" give the above code and config file. Thanks for the help Neil Lamka neil@meetingworks.com

      A Offline
      A Offline
      Andres Manggini
      wrote on last edited by
      #2

      Hi, This could help: Add a file named "app.config" to the project and compile your solution. Visual Studio .NET will automagically search for a file with that name (app.config) inside your project and create an output file to bin/debug (in this case), then, if you need to change the contents of that config file, modify app.config and it will be reflected on the output file. If you change the output file (when I say "output file" it means "testapp.exe.config") directly it will be overwritten by VS.NET on the next build. Hope this helps. (if I wasn't clear, please tell me and I will try to be :)) Andres Manggini. Buenos Aires - Argentina.

      1 Reply Last reply
      0
      • N Neil Lamka

        Ok, so I know I'm missing something very basic here but I am having a problem understanding how ConfigurationSettings work. I've looked at the various examples but still can't get it to work for me. I have a Windows application ... application name testapp. I've created a configuration file named testapp.exe.config and copied the file into (in this case) the bin\debug directory along with the EXE file. The config file looks like the following... copied from one of the examples: In my code I have the following statement. string appName = ConfigurationSettings.AppSettings["Application Name"]; What I get is appName = null and the config file is removed form the debug\bin directory. So, 1st, should the config file be being deleted..if so, are the actual settings stored someplace? and 2nd, what am I missing by not being able to read the value for "Application Name" give the above code and config file. Thanks for the help Neil Lamka neil@meetingworks.com

        R Offline
        R Offline
        Ranjan Banerji
        wrote on last edited by
        #3

        It should work. Works for me. Make sure the spelling is correct. The AppSettings are case sensitive.

        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