Step 1 : Create Project In Visual Studio (I am using version 2022 here ) : File ->New -> Project

Step 2 : Select Console App and Click Next :

Step 3 : Give Name Of Project and Click Next :

Step 4 : Click Create :

Step 5: It will create Project as below :

Step 6 : Right Click on Project Name In Right side pane and click Add -> Class

Step 7 : Give name of class and click Add as below :

Step 8 : Add code in Logger.cs as below :

Step 9 : If you move cursor to red line it will show error as : The name ‘ConfigurationManager’ does not exist in the current context

Severity Code Description Project File Line Suppression State
Error CS0103 The name ‘ConfigurationManager’ does not exist in the current context

The name ‘ConfigurationManager’ does not exist in the current context

Step 10 : To solve above error : click on Show Potential Fixes as in above snapshot : click on Find and install latest version as below :

Step 11 : Write click on project Add -> New Item :

Step 12 : select Application configuration file and click on Add :

Step 13 : Add code too App.config file as below :

Step 14 : Modify Program.cs file as below :

Step 15 : Run the application :

Step 16 : click on continue :

Step 17 : Now check log file in folder C:\temp

So , today we have created simple log writer example using c# and we understood how to resolve error : The name ‘ConfigurationManager’ does not exist in the current context.

Happy Learning..

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top