Skip to content

MSBuild Tips & Tricks

Kirill Osenkov edited this page May 17, 2016 · 21 revisions

#MSBuild.exe /pp MSBuild preprocessor. Pass /pp to the command line to create a single huge XML project file with all project imports inlined in the correct order. This is useful to investigate the ordering of evaluation and execution. Example:

msbuild MyProject.csproj /pp:inlined.proj

#MSBuild.exe /m Parallel build. Many people still don't know that they can significantly speed up their builds by passing /m to MSBuild.exe.

#EnvironmentVariables

  • MSBUILDTARGETOUTPUTLOGGING - set this to enable printing all target outputs to the log.
  • MSBUILDLOGTASKINPUTS - log task inputs.
  • MSBUILDEMITSOLUTION - save the generated .proj file for the .sln that is used to build the solution.
  • MSBUILDENABLEALLPROPERTYFUNCTIONS - enable additional property functions.
  • MSBUILDLOGCODETASKFACTORYOUTPUT - dump generated code for task to a .txt file in the TEMP directory