dotnet / dotnet/msbuild

[Feature Request]: Expand $(~) to $(HOME) or $(USERPROFILE) depending on OS

Open
#10,160 4 comments 4 reactions 0 assignees View on GitHub
backlog Feature Request needs-design Priority:2 triaged
Dominant language
C#
Stars
5.5k
Forks
1.5k
Avg merge
1d 8h
Merged PRs (30d)
141

Description

### Summary

Currently, you need to do something like the following to consistently get the `~` home directory in a cross-platform way:

```xml

$(HOME)
$(USERPROFILE)

```

It would be awesome if the well-known shorthand `~` (even PowerShell Core knows it) could be used directly in MSBuild as a built-in envvar alias for either `$(HOME)` or `$(USERPROFILE)` depending on the current OS, just like `pwsh` does it.

### Background and Motivation

No particular problem, just a desire for more consistency across developer tooling in the ecosystem (following the lead from `pwsh`).

### Proposed Feature

Summary contains the proposal, which would be to consider `~` as an alias to either `Home` or `UserProfile` envvar names in Unix-like vs Windows.

### Alternative Designs

_No response_

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.