Search code examples
c#.netconsole-applicationapp-config

Difference between app.config and appsettings.json


I am trying to create a console application using .NET framework 4.7.2. I see an app.config file by default present in the project.

App.config is used to store configuration details of project. Just wanted to know the difference between app.config and appsettings.json


Solution

  • app.config is used to store configuration details for a .NET Framework application, and it's a traditional way to store configuration data in XML format. However, in recent times, there's a trend towards using appsettings.json files instead of app.config for storing configuration data in .NET applications.

    The main difference between app.config and appsettings.json is the format of the data they store. app.config uses XML format, while appsettings.json uses JSON format.

    Another difference is that app.config is specific to .NET Framework, while appsettings.json is used in .NET Core applications. You also get web.config, which is used specifically for a .NET Framework Web based application.

    In your case I would go with what the framework provided and use the app.config file.