To enable msbuild
in Command Prompt, you simply have to add the directory of the msbuild.exe
install on your machine to the PATH
environment variable.
You can access the environment variables by:
- Right clicking on Computer
- Click Properties
- Then click Advanced system settings on the left navigation bar
- On the next dialog box click Environment variables
- Scroll down to
PATH
- Edit it to include your path to the framework (don’t forget a “;” after the last entry in here).
For reference, my path was C:\Windows\Microsoft.NET\Framework\v4.0.30319
Path Updates:
As of MSBuild 12 (2013)/VS 2013/.NET 4.5.1+ and onward MSBuild is now installed as a part of Visual Studio.
For VS2015 the path was %ProgramFiles(x86)%\MSBuild\14.0\Bin
For VS2017 the path was %ProgramFiles(x86)%\Microsoft Visual Studio\2017\<YOUR_VS_EDITION>\MSBuild\15.0\Bin
For VS2019 the path was %ProgramFiles(x86)%\Microsoft Visual Studio\2019\<YOUR_VS_EDITION>\MSBuild\Current\Bin
where <YOUR_VS_EDITION>
matches the Visual Studio edition that you have installed, i.e., Preview
, Community
, Professional
, Enterprise
.