dotnet run --project issue

Open
#34,331 4 comments 1 reaction 1 assignee View on GitHub

@baronfel is already working on this.

Since Jul 31, 2023.

Assessment

This issue has not been assessed yet.

Description

Area-WebSDK untriaged

Hi, same issue was created here https://github.com/dotnet/core/issues/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.

Dominant language
C#
Stars
3.2k
Forks
1.3k
Avg merge
4d 1h
Merged PRs (30d)
235

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from dotnet/sdk

All issues in dotnet/sdk

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.