Tuesday, July 3, 2018

Run Visual Studio Command Tools Within Powershell

Visual Studio command tools (ie, msbuild, mstest, dotnet) can be directly executed from Powershell and open in a new window.

Likewise, the reverse can also occur.  You can run Powershell from within the Visual Studio tools.

  1. Depending on your version of Visual Studio, locate the path to the common tools.  For example, if you decided to set an environment variable for this path, it could be something like:
    1. VS150COMNTOOLS=C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\Tools\
    2. VS140COMNTOOLS=C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools\
    3. VS120COMNTOOLS=C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\Tools\
    4. VS110COMNTOOLS=C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\Tools
  2. At this point,  you can open the tool by opening Run --> cmd.exe /k ""%VS150COMNTOOLS%VsDevCmd.bat" & powershell"
  3. At this point, a Powershell prompt will open so that you can directly run msbuild, mstest, etc.

No comments:

Post a Comment