Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

148
Views
.Net IConfiguration has wrong folder context

In my .Net Core project I am using the IConfiguration interface to handle some configuration.

Inside my classes it is used like this:

public MyClass(IConfiguration configuration)
{
    var someValue = configuration.GetSection("Key").Value;
}

And everything works fine when I start the project.

The problem is when I start the program from another location, e.g. a Shortcut.

Then the IConfiguration tries so find the "appsettings.json" in the folder, where the shortcut is located.

Is there some way to configure the IConfiguration in a central place and define a constant folder where the settings should be searched for.

over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

You can try using ConfigurationProvider/ConfigurationBuilder to either use environment variables for the settings or can specify the location of appsettings.json and use it.

https://docs.microsoft.com/en-us/dotnet/core/extensions/configuration-providers https://docs.microsoft.com/en-us/dotnet/api/microsoft.extensions.configuration.configurationbuilder

over 4 years ago · Santiago Trujillo Report

0

Maybe i should have digged deaper into my code, and I found an Extensions class that searches the app.settings quite dirty. Sorry to bother you, but thanks for your help!

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!