App.config Settings for a Project with no Output

Sometimes more than just connection strings need to be stored to a settings or configuration file of some kind. If you are building a mult-tier application and your project is a class library with no run-able code, you can't just throw settings into an app.config file. Likewise, you wouldn't want to put your tier-specific settings in a different project just because that project contains the output (and the app.config).

A simple way around this problem is to create a settings file for your project.  To do so, right click on your project and select "Properties"

Navigate to the "Settings" tab and click the link to create a new settings file

Add the application specific parameters to your settings file via the designer.  Save and rebuild your project.

To use your settings, reference them via the following syntax:

Properties.Settings.Default.MySetting

Enjoy!

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*