dotnet / dotnet/aspnetcore

Allow specifying default project/UserSecretsId for dotnet user-secrets

Open
#46,116 8 comments 2 reactions 0 assignees View on GitHub
area-commandlinetools feature-user-secrets
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 6h
Merged PRs (30d)
290

Description

### Is there an existing issue for this?

- [X] I have searched the existing issues

### Is your feature request related to a problem? Please describe the problem.

We have multiple deployables (services/workers) in the same repo/solution.

They share the same local configuration, including user secrets (by virtue of the UserSecretsId value being consistent across all project files). This is necessary because managing config consistency locally across many projects is a nightmare otherwise.

When I run any of the `dotnet user-secrets` subcommands, they fail because I haven't specified a `--project` option. I can begrudgingly pick a project, though it's completely arbitrary - and it's hard to explain to new devs (we have a complicated entry in the readme explaining what/why).

### Describe the solution you'd like

I would love it if I could add a JSON file in the directory, that specifies either the UserSecretsId, or a path to the default project.

e.g.

```
~/repo/src> cat user-secrets.json
{
"UserSecretsId":
}
```

This would also be super-handy to be able to specify this at the root of the repository, rather than needing to navigate into the project directory to manipulate user secrets.

e.g.

Repo root directory = /repo
Project directory = /repo/src/deployables/Api

```
~/repo> dotnet user-secrets list
It:Just:Works = true
```

### Additional context

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.