Visual Studio Online automatically builds version versions and build assemblies

I have been using TeamCity for a long time. The AssemblyInfo patcher has the ability to fix all buildinfo files with the version number that is generated and increased using TeamCity. Is this possible with Visual Studio Online Build (new scripting, cross-platform)?

+5
source share
1 answer

I created Bash Script , which automatically replaces the version number in files such as AssemblyVersion.cs, and can be used in the build step, similar to the Power Shell Script published by 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 (eg 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 

First create variables for the major and minor versions enter image description here

Second, set the assembly number format to $(BuildDefinitionName)_$(Major).$(Minor).$(Year:yy)$(DayOfYear).$(Rev:rr) on the General tab in the assembly definition

enter image description here

And finally, create a bash step - a script or Powershell with scripts on top: enter image description here

+5
source

Source: https://habr.com/ru/post/1234216/


All Articles