Build MSBuild target without dependencies

EMP picture EMP · Feb 28, 2011 · Viewed 14.3k times · Source

Is there any way I can tell MSBuild 4.0 to build a target, but ignore any dependencies? I just want to build that target itself, nothing else.

Answer

Lee K-A picture Lee K-A · Nov 14, 2011

I would like to reiterate @EMP's solution (and I can't vote him up due to my puny reputation).

The correct way to avoid MSBuild's default behavior of rebuilding all the dependencies listed in the project file is to set the BuildProjectReferences property to false.

In his answer he invokes MSBuild from within an MSBuild script; here's an example from the command line:

MSBuild myproj.csproj /p:Configuration=Debug /p:BuildProjectReferences=false /t:Build