I have created a .NetCore app in visual Studio and I want connection strings to be fetched from .json files, I have created the .json file launchSettings.json and added the configuration variables as shown.
{
"profiles": {
"TwinSample": {
"commandName": "Project",
"environmentVariables": {
"moduleEdgeHubConnectionString": "HostName=xxxx.xxx;DeviceId=xxxxx;ModuleId=xxxxxx;SharedAccessKey=xxxxx",
"moduleEdgeAgentConnectionString": "HostName=xxxx.xxx;DeviceId=xxxx;ModuleId=xxxxx;SharedAccessKey=xxxxx"
}
}
}
}
when I execute it the connection strings in the .cs project is Null that is moduleEdgeHubConnectionString and moduleEdgeAgentConnectionString is not able fetch the values from .json files.
private static string moduleEdgeHubConnectionString = Environment.GetEnvironmentVariable("moduleEdgeHubConnectionString");
private static string moduleEdgeAgentConnectionString = Environment.GetEnvironmentVariable("moduleEdgeAgentConnectionString");
I have also changed the properties like Build Action to Content and copy to output Directory to copy always.
can you please help me in resolving this.