dotnet / dotnet/aspnetcore

Use $HOME/.config/Microsoft/ASP.NET instead of $HOME/.aspnet in unix-like environments

Open
#43,278 4 comments 20 reactions 0 assignees View on GitHub
area-dataprotection
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.

Henlo. This is a classic issue raised in any project.
Currently ASP.NET pollutes user $HOME directories by placing an unnecessary folder there:

```js
const baseFolder =
process.env.APPDATA !== undefined && process.env.APPDATA !== ''
? `${process.env.APPDATA}/ASP.NET/https`
: `${process.env.HOME}/.aspnet/https`;
```

```c#
// Use*NIX conventions for a folder name.
retVal = new DirectoryInfo(Path.Combine(homePath, ".aspnet", DataProtectionKeysFolderName));
```

https://github.com/dotnet/aspnetcore/blob/d6047b42ffedcd24d45f627e0a96b92ead6c8e00/src/DataProtection/DataProtection/src/Repositories/DefaultKeyStorageDirectories.cs#L59-L60

This is a common pain for a long time for many people on unix-like platforms. I, as a user, want to have a sane output of directory listing, however any search that includes hidden dot-directories brings serious distraction when every tool strives to create a separate directory there:

```
find $HOME -maxdepth 1 -name '.*' | wc -l
70
```

### Describe the solution you'd like

There is a long-standing and widely adopted solution for that called [XDG convention](https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html). Long story short, it defines several folders for common usage (configuration, state, cache, etc.) which can be additionally configured via environmental variables, and suggests that applications should create sub-directories there and store their own files in an organized fashion. In example above JS code uses AppData folder, which is the experience i expect as user; XDG convention provides AppData folder equivalent for unix-like environments.

I suggest adopting XDG convention and bring some relief to end users during one of the major releases, and also placing ASP.NET folder within `Microsoft` folder, since without any grouping `.config` listings are a pain as well.

### 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.