dotnet / dotnet/arcade

Change the default dotnet installation location from `.dotnet/` to `.dotnet/$hostRid/`

Open
#14,751 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
729
Forks
397
Avg merge
3d 15m
Merged PRs (30d)
149

Description

The downstream repos have `dotnet.sh` script, which calls scripts in arcade to install dotnet in `:(top)/.dotnet/` directory's root if it wasn't present and continues using the one that was installed. If the installed .dotnet/dotnet belonged to a different platform, it fails with (a cryptic) run-time error.

I often find myself mounting the repo directory (with local changes) in docker container to test the build against different platform e.g.
`docker run --rm -v(pwd):/runtime -w /runtime --platform linux/amd64 ubuntu sh -c 'eng/install-native-dependencies.sh && ./build.sh clr+libs` (or using cross prereq image)
on Apple Silicon or Windows host machines. This requires deleting `.dotnet/` directory each time if the repo was built on host machine first (or vice-versa). In comparison, the `artifacts/` directory keeps the platform dependent bits separate in `$rid/` sub-directories and we don't need to delete it when switching the executing platform.

It would make things consistent if arcade installs dotnet in `$rid` sub-directory as well, to avoid installing when switching between the host and the container. i.e. `:(top)/.dotnet/win-arm64/dotnet.exe` instead of `:(top)/.dotnet/dotnet.exe` to match the followed under `artifacts/` directory.

> [!IMPORTANT]
> There is a difference between the $rid used under artifacts/ (which is always the "target RID") and proposed .dotnet/$rid (which is expected to be the "(effective) host RID"). For instance, if the host where docker is running has RID `osx-arm64`, the effective host in docker container where the build is running has `linux-x64` cross-targeting `freebsd-arm64`; then the dotnet is expected to be installed in `.dotnet/linux-x64`.

cc @ViktorHofer, @jkoritzinsky, @akoeplinger

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.