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. Windows configuration file

Windows configuration file

Scheduled Pinned Locked Moved C#
helpquestionworkspace
4 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.
  • U Offline
    U Offline
    User 446798
    wrote on last edited by
    #1

    I am facing a problem where the configuationfile from the bin directory gets deleted every time i run my windows application. I want to know where to place the windows configuration file. And why does it get deleted. shelly

    D 1 Reply Last reply
    0
    • U User 446798

      I am facing a problem where the configuationfile from the bin directory gets deleted every time i run my windows application. I want to know where to place the windows configuration file. And why does it get deleted. shelly

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      Because every time you do a complete rebuild of the application, the output directories get cleaned out. You might want to try putting the .INI file either in the application project folder or where the application can find it on the Path, like in the %WINDIR% folder, which, BTW, is not always C:\WINDOWS. By putting it in the application project folder, this folder will not get cleaned out when you rebuild your project. If your code is written correctly, it will not assume that the current directory is whatever directory the app was launched from. Instead, your code should ask the system from what directory is was launched from, then look in the directory for the configuration file. Check into storing Application.StartupPath and/or Environment.CurrentDirectory when your application starts and using it later to locate your configuration file. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

      U G 2 Replies Last reply
      0
      • D Dave Kreskowiak

        Because every time you do a complete rebuild of the application, the output directories get cleaned out. You might want to try putting the .INI file either in the application project folder or where the application can find it on the Path, like in the %WINDIR% folder, which, BTW, is not always C:\WINDOWS. By putting it in the application project folder, this folder will not get cleaned out when you rebuild your project. If your code is written correctly, it will not assume that the current directory is whatever directory the app was launched from. Instead, your code should ask the system from what directory is was launched from, then look in the directory for the configuration file. Check into storing Application.StartupPath and/or Environment.CurrentDirectory when your application starts and using it later to locate your configuration file. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

        U Offline
        U Offline
        User 446798
        wrote on last edited by
        #3

        hi I want to use the .exe.config file. I copied to the main project folder. Then also it is not reading the file. Please tell me from where all the application reads the exe.config file. Secondly, I created an .ini file also. I copied .ini file to bin, debug and project folder. I set the project output folder to first to bin then to debug. But the problem remains. please help shelly

        1 Reply Last reply
        0
        • D Dave Kreskowiak

          Because every time you do a complete rebuild of the application, the output directories get cleaned out. You might want to try putting the .INI file either in the application project folder or where the application can find it on the Path, like in the %WINDIR% folder, which, BTW, is not always C:\WINDOWS. By putting it in the application project folder, this folder will not get cleaned out when you rebuild your project. If your code is written correctly, it will not assume that the current directory is whatever directory the app was launched from. Instead, your code should ask the system from what directory is was launched from, then look in the directory for the configuration file. Check into storing Application.StartupPath and/or Environment.CurrentDirectory when your application starts and using it later to locate your configuration file. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

          G Offline
          G Offline
          Guinness4Strength
          wrote on last edited by
          #4

          Dave Kreskowiak wrote: Because every time you do a complete rebuild of the application, the output directories get cleaned out Actually this is not true. I have multiple applications that have INI files in the Debug & Release directories and they are not effected in any way when performing any build type in the build menu of VS.NET. Are you talking about some action other than those in the build menu ?

          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