Reputation: 3524
We're building and deploying our application to 30 separate web apps every night, and I would like to know which release every web app is currently on. For instance "Release-12345".
The value exists in the release variable Release.ReleaseName
from Release variables (MS doc), but I have no idea on how to make my pipeline use that value. My approach for now is to write it to the web.config, and the let the application read that value on demand. But if there's another, more efficient or "correct" way of doing it, I'm open for anything.
Upvotes: 0
Views: 722
Reputation: 41785
It's a classic usage of "replace tokens" tasks, there are many extensions in the marketplace, the most popular is Replace Tokens.
You need to add a placeholder in the web.config
, for example:
<add key="Release_number" value="#{Release_number}#" />
In the release variables you need to add a variable Release_number
with the value $(Release.ReleaseName)
, and add the Replace Tokens task in your release pipeline with configuration of:
web.config
#{
}#
Now, the task will search inside the web.config
file strings that match the pattern and will replace them with the value from the release variables.
Upvotes: 1