Skip to content

Consider install PowerShell as a tool #7078

@richlander

Description

@richlander

I wanted to do some testing with PowerShell in docker. The natural choice is to use the .NET SDK container image. But I ccan't because PowerShell is installed in a bespoke way.

root@88f149c70769:/# dotnet tool list -g
Package Id      Version      Commands
-------------------------------------
root@88f149c70769:/# dotnet tool install -g powershell
Tools directory '/root/.dotnet/tools' is not currently on the PATH environment variable.
If you are using bash, you can add it to your profile by running the following command:

cat << \EOF >> ~/.bash_profile
# Add .NET Core SDK tools
export PATH="$PATH:/root/.dotnet/tools"
EOF

You can add it to the current session by running the following command:

export PATH="$PATH:/root/.dotnet/tools"

You can invoke the tool using the following command: pwsh
Tool 'powershell' (version '7.5.4') was successfully installed.
root@88f149c70769:/# export PATH="$PATH:/root/.dotnet/tools"
root@88f149c70769:/# which pwsh
/usr/bin/pwsh

I wanted to use the GA version, but that's not convenient. If PowerShell was installed as a tool, I could.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions