MSBuild与ant';s项目帮助?
我来自ant背景,现在开始使用msbuild。我想创建一个.proj文件,其中包含清理、编译、部署等目标。在ant中,我希望我的用户运行MSBuild与ant';s项目帮助?,msbuild,Msbuild,我来自ant背景,现在开始使用msbuild。我想创建一个.proj文件,其中包含清理、编译、部署等目标。在ant中,我希望我的用户运行ant-project help,以获得目标列表及其描述。msbuild中似乎没有类似的内容,因此我考虑将DefaultTargets设置为“Help”并添加此目标: <Target Name="Help"> <Message Text="/t:Clean - Remove all bin folders and generated fil
ant-project help
,以获得目标列表及其描述。msbuild中似乎没有类似的内容,因此我考虑将DefaultTargets设置为“Help”并添加此目标:
<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>
运行msbuild时,我看到以下内容:
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
Microsoft(R)生成引擎版本3.5.30729.1
[Microsoft.NET Framework,版本2.0.50727.3053]
版权所有(C)微软公司2007。版权所有。
构建开始于2010年5月13日上午9:00:00。
节点0上的项目“C:\MyProject\MyProject.proj”(默认目标)。
/t:清除-删除所有bin文件夹和生成的文件
/t:编译-生成程序集
/t:部署-安装程序集
已完成生成项目“C:\MyProject\MyProject.proj”(默认目标)。
构建成功。
0个警告
0个错误
时间流逝00:00:00.05
我的目标描述隐藏在所有其他输出中
我觉得这里有一个范例不匹配。提供我想要的构建功能以便用户知道在哪里可以找到每个目标的最佳方法是什么?恐怕没有干净的方法来实现您想要的。创建默认帮助目标是一个好主意 要获得更清晰的输出,您可以将
消息
任务的重要性
属性设置为高
,使消息更加突出
<Target Name="Message">
<Message Text="/t:Clean - Remove all bin folders and generated files" Importance="high"/>
<Message Text="/t:Compile - Generate assembly" Importance="high"/>
<Message Text="/t:Deploy - Install the assembly" Importance="high"/>
</Target>
/t:Clean - Remove all bin folders and generated files
/t:Compile - Generate assembly
/t:Deploy - Install the assembly