Windows environment variables at appsettings.json

37 Views Asked by At

I'm trying to set AccessKeys in appsettings.Development.json to point to my OneDrive folder. Since some team members have their OneDrive at different folders, I was trying to use Windows environment variables like this:

"AppSettings": {
    "AccessKeys": "%OneDrive%\\project123\\keys\\",
}

However, the above attempt is not working since the file is not being found.

    internal XDocument ReturnFileContent(string filename)
    {
        string documentPath = _configuration["AppSettings:AccessKeys"];
        string xmlFilePath = Path.Combine(documentPath, filename);

        var aux = File.Exists(xmlFilePath); <- always false

        //...
    }
0

There are 0 best solutions below