You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, same issue was created here dotnet/core#7861
but seems like the bug still exists.
I was trying to run some project on Azure agent directly and failed to load appsetting.json file.
When you run "dotnet run --project "$(Build.SourcesDirectory)/src/MyProject/MyProject.csproj" then WebApplicationBuilder will search for appsettings in $(Build.SourcesDirectory), not in projects directory nor in Debug or Release folder.
To fix it I had to set correct base path and add again appsettings.json.
builder.Configuration.SetBasePath(AppContext.BaseDirectory);
builder.Configuration.AddJsonFile("appsettings.json", true);
Can you fix it or maybe add parameter to allow for setting execition folder context.
The text was updated successfully, but these errors were encountered:
Hi, same issue was created here dotnet/core#7861
but seems like the bug still exists.
I was trying to run some project on Azure agent directly and failed to load appsetting.json file.
When you run "dotnet run --project "$(Build.SourcesDirectory)/src/MyProject/MyProject.csproj" then WebApplicationBuilder will search for appsettings in $(Build.SourcesDirectory), not in projects directory nor in Debug or Release folder.
To fix it I had to set correct base path and add again appsettings.json.
builder.Configuration.SetBasePath(AppContext.BaseDirectory);
builder.Configuration.AddJsonFile("appsettings.json", true);
Can you fix it or maybe add parameter to allow for setting execition folder context.
The text was updated successfully, but these errors were encountered: