dotnetup: install to user-local location when `$host$` is in `global.json`'s `sdk.paths`
- Dominant language
- C#
- Stars
- 3.2k
- Forks
- 1.3k
- PR merge metrics
- PR metrics pending
Description
### Prerequisites
- [x] I have read the [dotnetup documentation](https://github.com/dotnet/sdk/tree/release/dnup/documentation/general/dotnetup).
- [x] I have searched for [existing dotnetup issues](https://github.com/dotnet/sdk/issues?q=is%3Aissue%20state%3Aopen%20label%3Adotnetup).
- [x] I have searched for [existing dotnetup discussions](https://github.com/dotnet/sdk/discussions/categories/dotnetup).
### Issue type
Bug report
### Description
I ran `dotnetup install preview` in a folder that has a `global.json` that includes
```json
{
"sdk": {
"allowPrerelease": true,
"paths": [
"$host$"
],
"errorMessage": "The .NET SDK could not be found, please run a command-line build with ./build.cmd."
}
}
```
and got
```sh-session
❯ dotnetup install preview
Installing .NET SDK 11.0.100-preview.5.26302.115 to /home/raines/src/msbuild/$host$...
Downloading .NET SDK 11.0.100-preview.5.26302.115 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100%
Installing .NET SDK 11.0.100-preview.5.26302.115 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100%
Installed at /home/raines/src/msbuild/$host$:
.NET SDK 11.0.100-preview.5.26302.115
```
But `$host$` is a [sentinel value that means "fall back to the default location"](https://github.com/dotnet/runtime/blob/7f49565b668b93492181b98572be79c54448cd68/src/native/corehost/fxr/sdk_resolver.cpp#L123-L126). It shouldn't be interpreted as a literal local path.
I think the most reasonable behavior would be to fall back to the user-local path in this case.
### dotnetup version
0.1.4-preview.4.26303.1+1d41e9a310ae4b0d6f0730816c7d6f6ab730f7f6
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.