I know how to interact with properties built into the .NET runtime using the app.config file, however I would like to be able to set custom properties using the app.config file and cannot find information on how to do this manually by editing the file manually (I donβt want to use the constructor to create the settings file, since we already have one that I donβt want the designer to touch). As an example for my ultimate goal, I would like to do something like the following for a service (this is just pseudo-xml, if the syntax is correct, this is completely coincidental):
<?xml version="1.0"?> <configuration> <my.assembly.namespace> <application> <UsageStatistics logging="on" path="relative/or/absolute/path.log" otherproperties... /> </application> <startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup> </configuration>
Where UsageStatistics is a static class that I created that will be used to switch various logging options, including a property for setting logging and other various properties to control what is logged, where and how often, etc.
Instead of a simple answer, it would be great if a link to any relevant articles explaining how the app.config file works can be included or sent, so I can try to figure out the answer myself, instead of falsely feeding me. I Googled in order to understand a little how to implement this myself, but could not find any clear articles explaining how to set user-defined properties outside the constructor.
I would also like to note that I do not want to use environment variables to configure functions in this service (there would be too many properties to create and support the end user).
Thanks in advance for your help!
source share