Posts

Showing posts from August, 2017

Web.config no longer exists in .Net Core

Image
I thought to write a post about my journey making projects with .Net Core but that will be a long post and maybe nobody will read it; instead I will make a series of posts with some topics I found interesting to talk about.

Many of us come from ASP.NET 4 and old versions, we used to work with Web.config in our web projects, a file to place our settings in XML format, but it no longer exists in .Net Core (or at least in our Solution Explorer).

In .Net Core we use appsettings.json to place our settings in JSON format. Let's see how this works by getting our hands dirty:

1) Create a .Net Core Web Application project:

You will see a bunch of files generated from the template in the Solution Explorer. appsettings.json is meant to replace settings previously located in Web.config . To catch these configurations in the project, the Startup.cs file has the following lines:



As you can see the appsettings.json file is added to the ConfigurationBuilder. Also, pay attention to the $"apps…