Code2night
  • Home
  • Guest Posts
  • Tutorial
  • Languages
    • Angular
    • C
    • C#
    • HTML/CSS
    • Java
    • JavaScript
    • Node.js
    • Python
    • React
    • SQL Server
    • TypeScript
  • Post Blog
  • Tools
    • JSON Beautifier
    • HTML Beautifier
    • XML Beautifier
    • CSS Beautifier
    • JS Beautifier
    • PDF Editor
  • Register
  • Login
  1. Home
  2. Blogpost

ConfigurationBuilder does not contain a definition for SetBasePath

Date- Mar 03,2021

19065

Appsetting jso Dot Net Core

Issue-

So , while working with .Net core you often need to read app json file from siteroot to access connection string and other keys available there. So in previous versions we used to use Configuration Builder for reading json file using SetBasePath Method.We used to write

new ConfigurationBuilder().SetBasePath(Directory.GetCurrentDirectory()).AddJsonFile("appSettings.json").Build();

But the same code becomes non reachable when it comes to .Net core as  you receive error which is shown in below image saying 'ConfigurationBuilder' does not contain a definition for 'SetBasePath' . So will see how to make this work in .Net core 3.1. 

So, This issue is basically because of a missing package in .Net core 3. So for this you have to add Microsoft.Extension.Configuration.json in your project. You can find this package on Nuget package as shown in image.


You can also install this package using Package Manager console using this command. For more reference you can have a look at https://www.nuget.org/packages/Microsoft.Extensions.Configuration.Json and then have a look at installation steps.

Install-Package Microsoft.Extensions.Configuration.Json -Version 5.0.0

So , after you successfully install this package you can check SetBasePath method will start working as expected. You can have a look at below image.


So ,you can follow the steps and this is how you can read app.json file in .Net core 3.1. 

Comments

Tags

Swagger UI
Swashbuckle
SwashbuckleAspNetCore
Rest API
Postman
Api Testing
ITextSharp
Export to Pdf
AspNet Core
AspNet
C#
View to Pdf in Aspnet
Scheduler
Fibonacci series in Java
Display Fibonacci Series
First C# Program
What is C?
C
C Programming
CodeLobster
Free Download for Youtube Subscribers!

First click on Subscribe Now and then subscribe the channel and come back here.
Then Click on "Verify and Download" button for download link

Subscribe Now | 1760
Download
Support Us....!

Please Subscribe to support us

Thank you for Downloading....!

Please Subscribe to support us

Continue with Downloading
Be a Member
Join Us On Whatsapp Join Us On Facebook
Code2Night

A community platform for sharing programming knowledge, tutorials, and blogs. Learn, write, and grow with developers worldwide.

Panipat, India   info@code2night.com

Quick Links
  • Home
  • Blogs
  • Tutorials
  • About Us
  • Contact
  • Privacy Policy
  • Terms & Conditions
  • Guest Posts
Dev Tools
  • JSON Beautifier
  • HTML Beautifier
  • XML Beautifier
  • CSS Beautifier
  • JS Beautifier
  • PDF Editor
By Language
  • Angular
  • C
  • C#
  • HTML/CSS
  • Java
  • JavaScript
  • Node.js
  • Python
  • React
  • SQL Server
  • TypeScript
© 2026 Code2Night. All Rights Reserved.
Built with for developers