What is app.config for?

前端 未结 4 2040
春和景丽
春和景丽 2020-11-30 01:40

Settings.settings generates Settings.Designer.cs which presumably generates app.config which then is copied to output directory as

4条回答
  •  离开以前
    2020-11-30 02:44

    The config file is optional, if it does not exist environments such as ASP.NET will fall back to the machine.config file stored in the .NET system directories to get machine wide defaults.

    If you actually add code to your app to retrieve settings from the config file (say using the ConfigurationManager class) and it does not exist, you will receive null values.

    That is why it is important to check for this siutation and have your application make it's own decision on how/if to continue.

提交回复
热议问题