I'm deploying a web app to Azure using Visual Studio Team Services to build and then release.
During release I'm replacing tokens within the web.config
file with environment variables I have setup within the release definition for each environment, staging, production etc.
I have set the Release Name Format to include the build number and release number using the following:
$(Build.BuildNumber).$(rev:r)
I know Release.ReleaseName
is provided as a pre-defined global release variable, but how can I access this Release.ReleaseName
variable within my app to display it in a footer?
Usually, you can use Tokenization build / release task to transfer the value of a variable into web.config file.
But since the variable you want to use is filled with the value of another variable, you need to add an additional powershell step to do this.
Following are the steps for you reference:
Change the content that you want to replace in web.config to __Eddie__.
Add a powershell step to set the value of "Eddie" to "Release.ReleaseName".
Now, when you start the release, the content in web.config will be replaced by the value of Release.ReleaseName.