vscode-dev-containers
vscode-dev-containers copied to clipboard
dotnet image: "Wrong" non-feature pwsh is selected by terminal profile
- VSCode Version: 1.69
- Local OS Version: N/A
- Local chip architecture: N/A
- Reproduces in: Both
- Name of Dev Container Definition with Issue: dotnet
Steps to Reproduce:
- Use default devcontainer config and specify
powershell: latest
in features and"terminal.integrated.defaultProfile.linux": "pwsh"
in settings.
// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
// https://github.com/microsoft/vscode-dev-containers/tree/v0.238.1/containers/dotnet
{
"name": "C# (.NET)",
"build": {
"dockerfile": "Dockerfile",
"args": {
// Update 'VARIANT' to pick a .NET Core version: 3.1, 6.0
// Append -bullseye or -focal to pin to an OS version.
"VARIANT": "6.0-bullseye-slim",
// Options
"NODE_VERSION": "none"
}
},
// Configure tool-specific properties.
"customizations": {
// Configure properties specific to VS Code.
"vscode": {
"settings": {
"terminal.integrated.defaultProfile.linux": "pwsh"
}
}
},
"remoteUser": "vscode",
"features": {
"powershell": "latest"
}
}
- Start devcontainer and click the "new terminal" button
-
which pwsh
will show this is running the powershell in /opt/powershell/7 rather than the one downloaded as a feature
This is because the dotnet image already ships with a powershell in /opt/powershell/7
and the default pwsh profile "resolver" seems to find this first rather than the one that gets placed in /usr/share/powershell/.store/powershell.linux.x64
by the feature. Starting pwsh
from bash/zsh will also use the "wrong" one unless you explicitly specify /usr/bin/pwsh
Remediation
The feature script should probably check for this existing pwsh and remove the link if found.
Workaround
-
"postCreateCommand": "sudo rm /usr/local/bin/pwsh"