3

As far as I understand all default settings of app.config settings is hard coded in the application and will generated on the fly in the first run.

If this is true then there is no good reason to deploy these files with an installer or in a zip package, am I right? Or am I missing something in here.

I want to be sure before rolling out the next release.

1 Answer 1

8

Default settings are hard coded, but required settings are not. If you have any required settings at all, then your application will throw an exception when trying to load the section the required setting is in if it doesn't exist, and if the file doesn't exist, then the setting doesn't exist.

Also, this only applies to custom sections... If you use default sections like ConnectionStrings, then you need to deploy your app.config with your application, because this is the only place these are stored.

Long story short, yes, you do need to deploy app.config with your application.

4
  • This is desktop application and only relies on the My.Settings (VB.NET). And what is "required" settings?
    – dr. evil
    Jun 28, 2009 at 19:47
  • If you have an app.config file, you need to deploy it. I'm 90% sure that My.Settings is seperate, but I could be wrong. Jun 29, 2009 at 0:12
  • 3
    Ok, I've done some research. If you have an app.config file in your PROJECT, then yes, you need to deploy it. If you only have one in your project output (ie. /bin/Debug/app.config), then it's safe to discard it in your deployment as it's just saved settings from testing. Jun 29, 2009 at 0:21
  • Required settings are something from custom configuration sections... It's a little more complex then just relying on My.Settings, but it's alot more flexible. Have a look here for more info: codeproject.com/KB/cs/CustomConfigurationSectio.aspx Jun 29, 2009 at 0:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.