我正在使用TeamCity很长一段时间.该集信息补丁必须修补所有集信息与被产生,并通过TeamCity的递增版本号文件的能力.使用Visual Studio Online Build(新的可编写脚本的,跨平台的)可以实现这种方式吗?
我创建了一个Bash脚本,它自动替换AssemblyVersion.cs等文件中的版本号,可以在构建步骤中使用,类似于Microsoft发布的Power Shell脚本:
#!/bin/bash
# Sample call: ./ApplyVersionToAssemblies.sh ../Source/ AssemblyInfo.cs XamarinAndroid_1.0.0.1
echo "Script to automatically set the version-number in files (e.g. AssemblyInfo.cs)"
if [ $# -ne 3 ]; then
echo "Usage: $0 path_to_search filename build_number"
exit
fi
# Input is something like XamarinAndroid_1.2.3.4 and we want to extract only the 1.2.3.4
# See http://stackoverflow.com/a/19482947/448357 for more infos
VERSION_NUMBER="${3#*_}"
for file in $(find $1 -name $2); do
echo "Replacing Version string in $file with ${VERSION_NUMBER}"
sed -i '' -e 's/"[0-9]*\.[0-9]*\.[0-9]*\.[0-9]*"/"'${VERSION_NUMBER}'"/' "$file"
done
Run Code Online (Sandbox Code Playgroud)
其次,将构建数字格式设置为$(BuildDefinitionName)_$(Major).$(Minor).$(Year:yy)$(DayOfYear).$(Rev:rr)构建定义的"常规"选项卡
最后使用上面的脚本创建一个bash-script或Powershell步骤:

| 归档时间: |
|
| 查看次数: |
8071 次 |
| 最近记录: |