https://github.com/olegsych/posh-vs
Makes Visual Studio command line tools available in PowerShell
https://github.com/olegsych/posh-vs
powershell visualstudio
Last synced: 10 months ago
JSON representation
Makes Visual Studio command line tools available in PowerShell
- Host: GitHub
- URL: https://github.com/olegsych/posh-vs
- Owner: olegsych
- License: mit
- Created: 2015-12-12T22:09:48.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2019-08-03T20:33:53.000Z (over 6 years ago)
- Last Synced: 2025-03-29T09:41:33.569Z (11 months ago)
- Topics: powershell, visualstudio
- Language: PowerShell
- Homepage:
- Size: 29.3 KB
- Stars: 32
- Watchers: 3
- Forks: 2
- Open Issues: 5
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
# 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](https://www.powershellgallery.com/packages/posh-vs):
```
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](https://msdn.microsoft.com/en-us/powershell/reference/5.1/microsoft.powershell.core/about/about_profiles).
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
[](https://ci.appveyor.com/project/olegsych/posh-vs/branch/master)
Install pre-requisites.
```
PS> .\init.ps1
```
`Ctrl+Shift+B` to build and test in [VSCode](https://code.visualstudio.com) or
```
PS> Invoke-psake
```
`F5` to debug tests in VSCode.
## Credits
posh-vs was inspired by [Alen Mack](http://allen-mack.blogspot.com/2008/03/replace-visual-studio-command-prompt.html),
[StackOverflow contributors](http://stackoverflow.com/questions/2124753/how-i-can-use-powershell-with-the-visual-studio-command-prompt)
and [posh-git](https://github.com/dahlbyk/posh-git).