• Visitors can check out the Forum FAQ by clicking this link. You have to register before you can post: click the REGISTER link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. View our Forum Privacy Policy.
  • Want to receive the latest contracting news and advice straight to your inbox? Sign up to the ContractorUK newsletter here. Every sign up will also be entered into a draw to WIN £100 Amazon vouchers!

A C# ConfigurationManager query

Collapse
X
  •  
  • Filter
  • Time
  • Show
Clear All
new posts

    A C# ConfigurationManager query

    I have little enough hair left as it is and everything on the net implies this is possible, so before I pull out the little remaining......

    I have 2 config files.

    1. Standard application.exe.config
    2. Separate file which I want to call Mappings.config.

    The Standard one works fine.

    When I try to OpenExeConfiguration on the Mappings .config, which is copied to the build folder correctly, it seems that the system is adding another .config to the file name,such that the System.Configuration.Configuration object generated by the OpenExe... statement has Mappings.config.config as the file name, and 0 entries in the AppSettings.

    All I want to do is open "Mappings.config" read some key value pairs exactly as I already do on the standard one.

    Have considered using a straight forward text file, but would prefer this method, if I can get it working.


    Any ideas?, thanks.
    Never has a man been heard to say on his death bed that he wishes he'd spent more time in the office.

    #2
    Originally posted by Scrag Meister View Post
    I have little enough hair left as it is and everything on the net implies this is possible, so before I pull out the little remaining......

    I have 2 config files.

    1. Standard application.exe.config
    2. Separate file which I want to call Mappings.config.

    The Standard one works fine.

    When I try to OpenExeConfiguration on the Mappings .config, which is copied to the build folder correctly, it seems that the system is adding another .config to the file name,such that the System.Configuration.Configuration object generated by the OpenExe... statement has Mappings.config.config as the file name, and 0 entries in the AppSettings.

    All I want to do is open "Mappings.config" read some key value pairs exactly as I already do on the standard one.

    Have considered using a straight forward text file, but would prefer this method, if I can get it working.


    Any ideas?, thanks.

    See here c# - OpenExeConfiguration Path Issue - Stack Overflow

    edit: and http://stackoverflow.com/questions/5...le-application

    Comment


      #3
      You must spread some Reputation around before giving it to mudskipper again.

      Thanks.

      I have come to the conclusion that it is not possible to have 2 "appSettings" config files, so have reverted to having just the one.

      1 "connectionStrings" file and 1 "appsettings" file is what seems to be possible.

      Did try using the connectionStrings file as the secondary config, but the structure for the items is different and would only confuse users when they edited it.

      Oh well, onward and upward, have wasted too much time on this already.

      Comma delimited text file anyone?
      Never has a man been heard to say on his death bed that he wishes he'd spent more time in the office.

      Comment

      Working...
      X