These instructions refer to working with the master
branch.
Latest Microsoft Visual Studio 2019: You can download the Visual Studio Community edition from https://www.visualstudio.com/en-us/products/visual-studio-community-vs.aspx.
All command lines should be executed from a Visual Studio developer command prompt.
- Clone the repo:
git clone https://github.com/Microsoft/msbuild.git
- Build on the command line:
.\build.cmd
- If you encounter errors, see Something's wrong in my build.
- Open the solution file in Visual Studio (
MSBuild.Dev.slnf
).
To run the unit tests from Visual Studio:
- Open the MSBuild solution file (
MSBuild.Dev.slnf
) in Visual Studio. - Open the Test menu -> Windows -> Test Explorer.
- Click Run All.
To build MSBuild and run all unit tests from the command line, use .\build.cmd -test
.
To mimic our CI job use eng\CIBuild.cmd
. Be aware that this command may delete your local NuGet cache.
The CI does two builds. In the second build, it uses the binaries from the first build to build the repository again.
Please see Contributing Code for details on contributing changes back to the code. Please read this carefully and engage with us early to ensure work is not wasted.
- Breaking into the main method of MSBuild.exe: set the environment variable
MSBUILDDEBUGONSTART
to 1 or 2: https://github.com/Microsoft/msbuild/blob/master/src/MSBuild/XMake.cs#L488-L501 - Dumping scheduler state: set
MSBUILDDEBUGSCHEDULER
to 1; setMSBUILDDEBUGPATH
to a directory to dump the scheduling state files.
To build projects using the MSBuild binaries from the repository, you first need to do a build which produces
a "bootstrap" directory. The "bootstrap" directory mimics a Visual Studio installation by aquiring additional
dependencies (Roslyn compilers, NuGet, etc.) from packages or from your local machine (e.g. props/targets
from Visual Studio). To produce a bootstrap build, run .\build.cmd /p:CreateBootstrap=true
from the root of your enlistment.
Now, just point artifacts\bin\bootstrap\net472\MSBuild\Current\Bin\MSBuild.exe
at a project file.
Sometimes it's useful to patch your copy of Visual Studio. You can use the Deploy-MSBuild script for that.