From 2a42beb8fd07fb0f16a61b592d308dca2201d547 Mon Sep 17 00:00:00 2001 From: Steven Liekens Date: Sat, 4 Oct 2025 10:00:23 +0000 Subject: [PATCH] Use /etc/profile.d to set PATH for dotnet tools --- src/dotnet/devcontainer-feature.json | 4 ++-- src/dotnet/install.sh | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/dotnet/devcontainer-feature.json b/src/dotnet/devcontainer-feature.json index 9389addaa..7d72c8cc0 100644 --- a/src/dotnet/devcontainer-feature.json +++ b/src/dotnet/devcontainer-feature.json @@ -1,6 +1,6 @@ { "id": "dotnet", - "version": "2.4.0", + "version": "2.4.1", "name": "Dotnet CLI", "documentationURL": "https://github.com/devcontainers/features/tree/main/src/dotnet", "description": "This Feature installs the latest .NET SDK, which includes the .NET CLI and the shared runtime. Options are provided to choose a different version or additional versions.", @@ -45,7 +45,7 @@ }, "containerEnv": { "DOTNET_ROOT": "/usr/share/dotnet", - "PATH": "$PATH:$DOTNET_ROOT:~/.dotnet/tools", + "PATH": "$PATH:$DOTNET_ROOT", "DOTNET_RUNNING_IN_CONTAINER": "true", "DOTNET_USE_POLLING_FILE_WATCHER": "true" }, diff --git a/src/dotnet/install.sh b/src/dotnet/install.sh index bd85fb91a..a6bde1ebd 100644 --- a/src/dotnet/install.sh +++ b/src/dotnet/install.sh @@ -146,6 +146,13 @@ if [ ! -e /usr/bin/dotnet ]; then ln --symbolic "$DOTNET_ROOT/dotnet" /usr/bin/dotnet fi +# Add .NET Core SDK tools to PATH for bash and zsh users +# This is where 'dotnet tool install --global ' installs tools to +# Use single-quoted EOF to defer $PATH expansion until sourcing the file +cat << 'EOF' >> /etc/profile.d/dotnet.sh +export PATH="$PATH:$HOME/.dotnet/tools" +EOF + # Clean up rm -rf /var/lib/apt/lists/* rm -rf scripts