Skip to content

Support PowerShell installed as .NET Core Global Tools #2110

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
maximpashuk opened this issue Jul 30, 2019 · 5 comments
Closed

Support PowerShell installed as .NET Core Global Tools #2110

maximpashuk opened this issue Jul 30, 2019 · 5 comments
Labels
Area-Startup Issue-Enhancement A feature request (enhancement). Up for Grabs Will shepherd PRs.

Comments

@maximpashuk
Copy link

My issue related to following newsblog:

https://devblogs.microsoft.com/powershell/introducing-powershell-as-net-global-tool/

I have uninstalled PowerShell 6.2.2 to test installation via dotnet tool install --global PowerShell
Everything is working fine.

Unfortunately, VSCode powershell extensions can't automatically pick up PowerShell installed as .net core global tool and falls back to built-in windows powershell 5.1.
For example, I can't change language mode

Can you modify autodetection mechanics so powershell as global tools picked up correctly?

@ghost ghost added the Needs: Triage Maintainer attention needed! label Jul 30, 2019
@SydneyhSmith
Copy link
Collaborator

Thanks for opening this issue @maximpashuk it looks like we need to incorporate ~.dotnet\tools\pwsh.exe into the paths we check for all available PowerShell versions on a system.

@ghost ghost added the Needs: Maintainer Attention Maintainer attention needed! label Jul 30, 2019
@rjmholt rjmholt added Issue-Enhancement A feature request (enhancement). Up for Grabs Will shepherd PRs. and removed Issue-Bug A bug to squash. Needs: Maintainer Attention Maintainer attention needed! Needs: Triage Maintainer attention needed! labels Jul 31, 2019
@JustinGrote
Copy link
Collaborator

Workaround

This is what I do for my scoop-installed powershells, you can do the same for the dotnet tools global folder

    "powershell.powerShellAdditionalExePaths": [
        {
            "exePath": "C:/Users/JGrote/scoop/apps/pwsh/current/pwsh.exe",
            "versionName": "Powershell"
        },
        {
            "exePath": "C:/Users/JGrote/scoop/apps/pwsh-preview/current/pwsh.exe",
            "versionName": "Powershell Preview"
        }
    ],

@maximpashuk
Copy link
Author

According to
#2503
this issue seems to be fixed, so I close it.

@ghost ghost added the Needs: Maintainer Attention Maintainer attention needed! label Mar 10, 2020
@TylerLeonhardt TylerLeonhardt removed the Needs: Maintainer Attention Maintainer attention needed! label Mar 10, 2020
@mromanch
Copy link

mromanch commented Jul 1, 2020

This does not work for me. I just tried re-installing dotnet tool install --global PowerShell but that doesn't change anything.

  1. Install PowerShell using dotnet tool install --global PowerShell
  2. Start Visual Studio Code, e.g. code .
  3. From the command pallet, run Terminal: Select Default Shell

Expected behavior: The list of available shells will include pwsh using the dotnet tool global path.

Actual behavior: There is no pwsh listed.

The "powershell.powerShellAdditionalExePaths" workaround doesn't work either.

VS Code version: Code 1.46.1 (cd9ea6488829f560dc949a8b2fb789f3cdc05f5d, 2020-06-17T21:13:20.174Z)
OS version: Windows_NT x64 10.0.18363

> dotnet tool list --global
Package Id                              Version      Commands
-------------------------------------------------------------
powershell                              7.0.1        pwsh

> (Get-Command pwsh).Source
C:\Users\alais\.dotnet\tools\.store\powershell\7.0.1\powershell\7.0.1\tools\netcoreapp3.1\any\win\pwsh.exe

> $env:Path
C:\Users\alais\.dotnet\tools\.store\powershell\7.0.1\powershell\7.0.1\tools\netcoreapp3.1\any\win; ... ; ...
System Info
Item Value
CPUs Intel(R) Core(TM) i7-6700 CPU @ 3.40GHz (6 x 3408)
GPU Status 2d_canvas: unavailable_software
flash_3d: disabled_software
flash_stage3d: disabled_software
flash_stage3d_baseline: disabled_software
gpu_compositing: disabled_software
multiple_raster_threads: enabled_on
oop_rasterization: disabled_off
protected_video_decode: disabled_off
rasterization: disabled_software
skia_renderer: disabled_off_ok
video_decode: disabled_software
viz_display_compositor: enabled_on
viz_hit_test_surface_layer: disabled_off_ok
webgl: unavailable_software
webgl2: unavailable_software
Load (avg) undefined
Memory (System) 29.44GB (9.62GB free)
Process Argv .
Screen Reader no
VM 0%
Extensions (33)
Extension Author (truncated) Version
vscode-openapi 42C 3.3.0
Bookmarks ale 11.3.1
project-manager ale 11.1.0
vscode-json and 1.5.0
vscode-markdownlint Dav 0.36.1
xml Dot 2.5.0
gitlens eam 10.2.2
eppz-code epp 1.2.41
vsc-material-theme Equ 32.8.0
vsc-material-theme-icons equ 1.1.4
easy-icons jam 0.3.1
azure-pipelines ms- 1.170.0
vscode-azureappservice ms- 0.17.0
vscode-azurefunctions ms- 0.22.1
vscode-azureresourcegroups ms- 0.2.0
vscode-azurestorage ms- 0.9.0
vscode-azurevirtualmachines ms- 0.1.1
vscode-cosmosdb ms- 0.13.0
vscode-docker ms- 1.3.1
csharp ms- 1.22.1
vscode-dotnet-runtime ms- 0.1.2
remote-wsl ms- 0.44.4
azure-account ms- 0.8.11
azurecli ms- 0.5.0
powershell ms- 2020.6.0
vscode-node-azure-pack ms- 0.0.11
team ms- 1.161.0
azurerm-vscode-tools msa 0.11.0
vscode-json-editor nic 0.2.3
quicktype qui 12.0.46
vscode-yaml red 0.8.0
code-spell-checker str 1.9.0
unique-window-colors stu 1.0.51

(10 theme extensions excluded)

@ghost ghost added the Needs: Maintainer Attention Maintainer attention needed! label Jul 1, 2020
@SydneyhSmith
Copy link
Collaborator

@mromanch thanks for this comment, if you would like to have PowerShell show up as an option for Terminal:Default Shell please open an issue in VSCode's repo as that is one of their editor commands that they would need to update to search for the global tool path...the additionalexespath setting influences the integrated console (rather than the terminal)...apologies for any confusion!

@SydneyhSmith SydneyhSmith removed the Needs: Maintainer Attention Maintainer attention needed! label Jul 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Startup Issue-Enhancement A feature request (enhancement). Up for Grabs Will shepherd PRs.
Projects
None yet
Development

No branches or pull requests

6 participants