Skip to content

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

Open
@am11

Description

@am11

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions