posh-vs
posh-vs copied to clipboard
Makes Visual Studio command line tools available in PowerShell
posh-vs
Makes Visual Studio command line tools available in PowerShell. Supports Visual Studio 2015 and later versions.
Usage
Install posh-vs from the PowerShell Gallery:
PS> Install-Module posh-vs -Scope CurrentUser
Change your PowerShell profile to automatically import Visual Studio developer environment.
PS> Install-PoshVs
Start a new PowerShell session or reload your profile:
PS> . $profile
Use Visual Studio command line tools in PowerShell:
PS> msbuild /?
How it works
Install-PoshVs
adds an Import-VisualStudioEnvironment
call to the PowerShell
profile.
It will import the environment variables set by the VsDevCmd.bat
of the latest version of Visual Studio installed
on your computer. If multiple instances of Visual Studio are installed, Import-VisualStudioEnvironment
will use whichever instance happens to be listed first.
To use a specific instance of Visual Studio, manually change your profile to import a specific batch file.
Import-BatchEnvironment 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\Tools\VsDevCmd.bat'
Uninstall
Remove posh-vs from your PowerShell profile.
PS> Uninstall-PoshVs
PS> exit
Uninstall posh-vs from your computer.
PS> Uninstall-Module posh-vs
Develop
Install pre-requisites.
PS> .\init.ps1
Ctrl+Shift+B
to build and test in VSCode or
PS> Invoke-psake
F5
to debug tests in VSCode.
Credits
posh-vs was inspired by Alen Mack, StackOverflow contributors and posh-git.