What is the MSBuild equivalent to ant's -project-help?

Posted by Jeremy Stein on Stack Overflow See other posts from Stack Overflow or by Jeremy Stein
Published on 2010-05-13T19:11:12Z Indexed on 2010/05/13 19:14 UTC
Read the original article Hit count: 217

Filed under:

I come from an ant background, and I'm starting to use msbuild. I want to create a .proj file with targets for clean, compile, deploy, etc. In ant, I would expect my user to run ant -project-help to get a list of the targets with their descriptions. There doesn't appear to be anything like this with msbuild, so I was thinking of setting DefaultTargets to "Help" and adding this target:

<Target Name="Help">
  <Message Text="/t:Clean - Remove all bin folders and generated files"/>
  <Message Text="/t:Compile - Generate assembly"/>
  <Message Text="/t:Deploy - Install the assembly"/>
</Target>

When I run msbuild, I see this:

Microsoft (R) Build Engine Version 3.5.30729.1
[Microsoft .NET Framework, Version 2.0.50727.3053]
Copyright (C) Microsoft Corporation 2007. All rights reserved.

Build started 5/13/2010 9:00:00 AM.
Project "C:\MyProject\MyProject.proj" on node 0 (default targets).
  /t:Clean - Remove all bin folders and generated files
  /t:Compile - Generate assembly
  /t:Deploy - Install the assembly
Done Building Project "C:\MyProject\MyProject.proj" (default targets).


Build succeeded.
    0 Warning(s)
    0 Error(s)

Time Elapsed 00:00:00.05

My target description are hidden among all the other output.

It feels like I have a paradigm-mismatch here. What's the best way to provide the build functionality I want so that users know where to find each target?

© Stack Overflow or respective owner

Related posts about msbuild