.net - How to read an environmental config with connection strings and other settings without referencing it in app.config? -


this question has answer here:

i have many winform(vb.net) apps local/dev/qa/prod environment setup. dynamically load environmental config information , access if in app.config file using system.configuration. haven't found solution yet. maybe i'm expecting , have manually deserialize environmental config. i'm looking ideas on how implement environmental config?

here's list of i'd like:

  • the environmental config file on file system containing xml structure(similar app.config).
  • dynamically load environmental config based on environment.
  • environmental config can contain connection strings , other settings. multiple additional config files acceptable.
  • use built in system.configuration calls access values. avoid having write custom deserializer.

i prefer not use these options if possible:

  • using configsource parameter in app.config point external config. need edited each environment , override(i think) section it's set.
  • using custom deserializer. know done , may actual solution. seems should solvable without doing this.
  • using system.environment isn't practical since reads/writes registry system variables.

you can try msbuild, can write own msbuild project file , tasks mentioned. can write c# code creating own tasks , including in msbuild project.

you can try transform xml msbuild task. 1 of link on transforming xml using transform task.


Comments