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

时间:2015-10-21 18:04:47

标签: azure-devops

我长期使用TeamCity。 AssemblyInfo修补程序能够使用由TeamCity生成和增加的版本号修补所有assemblyinfo文件。 Visual Studio Online Build(新的可编写脚本的,跨平台的)是否可以以某种方式实现?

1 个答案:

答案 0 :(得分:6)

我创建了一个Bash Script,它会自动替换AssemblyVersion.cs等文件中的版本号,并且可以在构建步骤中使用,类似于{{3}发布的Power Shell Script }:

*&bar

首先,为Major和Minor版本创建变量 Microsoft

其次,在构建定义的常规选项卡中将构建号格式设置为#!/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

enter image description here

最后使用上面的脚本创建一个bash-script或Powershell步骤: enter image description here