Do you add a local configuration file for developer-specific settings?
  v1.0 Posted at 12/01/2019 6:54 AM by Tiago Araujo

With .NET Core, we've got a new, extensible configuration system for our projects. This is easily extended and has out-of-the-box support for many configuration sources including JSON files, per-environment overrides, command-line parameters, and environment variables.

A common source of pain when working in a team is when different team members require different connection strings in order to run the project locally. If the developer modifies settings and then accidentally pushes that change into source control, the app might break for other developers.

Resolve this by:

Figure: #1 Create an appsettings.Local.json file. Set this to be ignored by your source code control system
Figure: #2 ​Add code to apply this configuration file in Program.cs

Now, any new developer that needs a custom connection string (or any other configuration setting) can create their own appsettings.Local.json file without affecting any other team member’s configuration.

Related rules

    Do you feel this rule needs an update?

    If you want to be notified when this rule is updated, please enter your email address: