How To: Team Build 自定义版本号
a) 自定义一个Task
b) 添加Task到TFSBuild.proj
1. 自定义一个Task
a. File -> New -> Project -> Class Library
b. 添加项目引用
项目右键 -> Add Reference -> Micosoft.Build.Engine/Framework/Tasks /Utilities 最好选择2.0版本,如果确定服务器运行的是3.5版本则两者皆可
c. 编写一个Task(继承自ITask 或者 Task)
Public class MyBuildNumber : Task
2. 将自定义的Task添加到TFSBuild.proj中
a) 签出对应的TFSBuild.proj
c) 将对应的dll签入到文件夹中
1. 手工拷贝到CIProjectTeamBuild (即:对应的BuildType文件夹), 而后手工添加,签入
2. 在命令行中切换到CIProjectTeamBuild, 运用命令签入
a. 切换到 Visual Studio 2008 Command Prompt
b. 切换到对应目录,例如 cd C:\Documents and Settings\tfsSetup\Desktop\TeamBuildTypes\CIProjectTeamBuild
c. 将对应的dll拷贝到该文件夹,如上图所显示的TfsBuildUntities.dll
d. 添加并签入该文件
a) Tf add TfsBuildUntities.dll
b) Tf checkin TfsBuildUnitities.dll
e. 添加对应的设置
1: <UsingTask TaskName="TfsBuildUtilities.MyBuildNumber" AssemblyFile=" TFSBuildUnities.dll"/>
2: <Target Name = "BuildNumberOverrideTarget" >
3: <MyBuildNumber BaseBuildName=" MyBuild_1.0" LastBuildNumber="$(LastBuildNumber)">
4: <Output TaskParameter="BuildNumber" PropertyName="BuildNumber"/>
5: </MyBuildNumber >
6: </Target>
f. Queue New Build