OverviewThis extension contains a build task that will update a predefined variable when this task is executed by 1. In a CI environment this task can be helpfull to automatically update a version after each successful build or release. This can reduce the effort of further passing a version down the line in building dlls with predefined versioning. PrerequisitesThis extension supports Azure DevOps Server 2019 and Azure Devops Online. How to useAfter installing the extension, you can add 1 task named 'Build Version Updater' to a new or existing build definition or release definition. Once you've added the 'Build Version Updater' you should have the following: Once you've added the task to your Build or Release pipeline you need to configure your individual task. Inside your task configuration you have 2 settings that are important:
VariablesThe 'Project Build Number Variable' is a variable that will be updated by this task. This is a variable that should already be existing withing your existing Pipeline and should be initialized to an integer value. Every time this task is run this variable will be updated by 1. Samayas Azure Devops Server ConnectionThis Task requires a PAT key in order to connect to your Azure Devops Server. Creating a PAT key for Azure Devops Server OnlineConnect to your online project Azure Devops Server -> https://dev.azure.com/youraccount. Click in the upper right corner on your username and select the Security menu. Once your have selected Security menu you'll see a Personal Access Tokens Menu. Click on the New Token + to create a new token. A Pop-up will show up where u can create a PAT token. Once you're in the creation popup you should give your PAT token a descriptive name so you know what you've created that Token for. You need to select the organization for which you want your token to be valid. You might have access to more than one organization or you could select All accessible organizations. Since the token you are creating is only for a specfic organizatio you should select that orgainzation. The expiry is the time the token stays valid, here you can specify a specifc date or just select 30 60 or 90 days. After the expiration you need to reupdate the token or the task won't work anymore. For this specific task the token needs the following access :
You need to select custom defined scopes and should one of those scopes not be available then you need to select Show all scopes. Once the PAT is created this is the only time to access the actual key. Here you need to copy the PAT key for later usage. When the PAT key is created it will show up in the list. Creating a PAT key for Azure Devops ServerConnect to your devops server-> https://devopsserver. Click in the upper right corner on your username and select the Security menu. Once your have selected Security menu you'll see a Personal Access Tokens Menu. Click on the Add to create a new token. A Pop-up will show up where u can create a PAT token. Once you're in the creation screen you should give your PAT token a descriptive name so you know what you've created that Token for. The expiry is the time the token stays valid, here you can specify a specifc date or just select 30 60 or 1 year. After the expiration you need to reupdate the token or the task won't work anymore. For this specific task the token needs the following access :
You need to select custom defined scopes and should one of those scopes not be available then you need to select Show all scopes. Once the PAT is created this is the only time to access the actual key. Here you need to copy the PAT key for later usage. When the PAT key is created it will show up in the list. Creating a Service ConnectionNow that you have a PAT token you can create a Service Connection. A Service Connection can be created through 2 ways :
Both ways will bring you in the Services Connection Settings Menu. The initial screen will not have any Service Connections or might have already other Service Connections for other services. Here you need to create a new Service Connection to use. Click on the New Service Connection and select a 'Samayas DevOps Endpoint'. As connection name you should give a descriptive name to indicate what your Service Connection is going to be used for. The PAT is the secret key that you have created previously. Then just create the Service Connection. Once the connection is created this will show up in the list. Use CaseThis variable can the be used in conjunction with a second variable to make a full version number So you have your variable that is updated and is named ex. ProjectBuildNumber. You have a second variable that is defining you major and minor version ex. ProjectPrefixVersionNumber. Then you have a final variable that will output your full variable ProjectVersionNumber. This variable can then be used throughout your the rest of your tasks as a variable to be used. Remarks: This can be used for Major.Minor.Build. ex 1.0.{ProjectBuildNumber}. The result will be 1.0.23.0 This can also be used for Major.Minor.Build.Revision. ex 1.0.0.{ProjectBuildNumber}. The result will be 1.0.0.23 In the end it's up to you to build the version that you want, this only updates a counter to be used in external variables. Selecting Service Connection in TaskOnce the Service connection is created you can select that service connection in the drop down from the task. Your configred task will look like this. TargetThe goal of this add-in is to manage versioning after building successfully. Version HistoryVersion 1.0 Initial Version Version 1.1 Release to Public Version 1.1.1 Update Description Version 1.2 Remove depreciated Task Handler |