How to setup and read appsettings when creating a project in Visual Code?

53 Views Asked by At

I started using Visual Code instead of VS- Unfortunately, I can't figure out how to setup appSettings.config and reference the key values using Configuration Manager.

This line throws a Nullreference exception:

var applicationId = ConfigurationManager.AppSettings["appId"].ToString();

I manually added the file appSettings.config when I created the console application. Here's the Folder structure:

enter image description here

Is there additional configuration needed?

1

There are 1 best solutions below

0
Chaka On

I needed to rename appsettings.config to app.config.