How to use PowerShell preview on Ubuntu?

zoby101's Avatar


09 Jul, 2019 01:07 PM

The Ubuntu image comes with PowerShell 6.2.1, I want to test on PowerShell 7.0.0-preview.1
It installs successfully and "pwsh-preview" command is added but the AppVeyor test still run on the old version.
I tried to add an alias "alias pwsh=pwsh-preview" but it did not help.

The yml setting:

  - sh: sudo apt-get install -y powershell-preview && alias pwsh=pwsh-preview && sudo sh -c 'echo "shopt -s expand_aliases\nalias pwsh=pwsh-preview" >> /etc/bash.bashrc' && sudo sh -c 'echo "shopt -s expand_aliases\nalias pwsh=pwsh-preview" >> ~/.bashrc'
The output

How can I make AppVeyor switch to the preview version?
Thank you

  1. Support Staff 1 Posted by Feodor Fitsner on 09 Jul, 2019 07:58 PM

    Feodor Fitsner's Avatar

    I don't think alias would work there as AppVeyor build agent is looking explicitly in PATH for pwsh executable. You can replace pwsh link though, I think, to point to pwsh-preview.

    Alternatively, you'd better use pwsh-preview directly in your tests rather than rely on build-int PowerShell runner.

  2. 2 Posted by zoby101 on 10 Jul, 2019 12:58 PM

    zoby101's Avatar

    Got it to work with:

      - sh: sudo apt-get install -y powershell-preview && sudo rm /usr/bin/pwsh && sudo ln -s /opt/microsoft/powershell/7-preview/pwsh /usr/bin/pwsh
  3. Support Staff 3 Posted by Feodor Fitsner on 10 Jul, 2019 02:03 PM

    Feodor Fitsner's Avatar

    Thanks for the update!

  4. Feodor Fitsner closed this discussion on 10 Jul, 2019 02:03 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac