Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

150
Vistas
.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 Respuestas
Responde la pregunta

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 Denunciar

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda