Visual Studio Online自动构建版本号增量和装配修补

Man*_*zas 7 azure-devops

我正在使用TeamCity很长一段时间.该集信息补丁必须修补所有集信息与被产生,并通过TeamCity的递增版本号文件的能力.使用Visual Studio Online Build(新的可编写脚本的,跨平台的)可以实现这种方式吗?

Ale*_*cha 7

我创建了一个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)

首先,为Major和Minor版本创建变量 在此输入图像描述

其次,将构建数字格式设置为$(BuildDefinitionName)_$(Major).$(Minor).$(Year:yy)$(DayOfYear).$(Rev:rr)构建定义的"常规"选项卡

在此输入图像描述

最后使用上面的脚本创建一个bash-script或Powershell步骤: 在此输入图像描述


归档时间:

查看次数:

8071 次

最近记录:

7 年,9 月 前