/Posh-VsVars

PowerShell helper for loading Visual Studio command line tools

Primary LanguagePowerShell

logo_256.png

Posh-VsVars

Powershell cmdlets to help import Visual Studios vsvars32.bat into the current shell session for use with

Compatibility

  • This is written for Powershell v2 / v3
    • Powershell v3 can be installed with Chocolatey via cinst powershell

Installation

Chocolatey

Once Chocolatey has been installed, simply use the cinst command.

cinst posh-vsvars

Chocolatey installation will both import the module into your PowerShell profile AND run Set-VsVars. If the default latest version behavior is undesirable, then edit the $PROFILE file, find where Posh-VsVars is dot-sourced from, and comment the line Set-VsVars

Supported Commands

Set-VsVars

Will find and load the vsvars32.bat file for the latest Visual Studio version installed on the given system, and will extract the environment information into the current shell session.

Set-VsVars

The same as above, except will only look for Visual Studio 2012.

Set-VsVars -Version '11.0'

Note a couple of useful points about this cmdlet:

  • The PROMPT environment variable is excluded from being overwritten
  • A global variable in the current session ensures that the same environment variables haven't been loaded multiple times.
  • PATH has duplicate entries removed in an effort to prevent it from exceeding the length allowed by the shell (generally 2048 characters)

Get-VsVars

Will find and load the vsvars32.bat file for the latest Visual Studio version installed on the given system, extrapolating it's environment information into a Hash.

Get-VsVars

The same as above, except will only look for Visual Studio 2012.

Get-VsVars -Version '11.0'

Credits

Roadmap

None AFAIK.. this is feature complete.