Is there a way to list all the build targets available in a build file?

后端 未结 2 380
梦如初夏
梦如初夏 2021-02-05 09:23

Given a build file (.csproj or msbuild.xml or whatever), I\'d like to run a msbuild command that lists all the available, defined targets.

Does that function exist?

2条回答
  •  生来不讨喜
    2021-02-05 10:17

    Starting with Visual Studio 16.6 preview 1, this is implemented in MSBuild.

    Example usage: msbuild myProject.proj -targets

    This should go out with Visual Studio 16.6 preview 1 (at some point in the future).

    (source: https://github.com/microsoft/msbuild/pull/5032#issuecomment-587901124)

    Documentation:

    -targets[:file]
                     Prints a list of available targets without executing the
                     actual build process. By default the output is written to
                     the console window. If the path to an output file
                     is provided that will be used instead.
                     (Short form: -ts)
                     Example:
                       -ts:out.txt
    

提交回复
热议问题