Use part of versionnumber as an IIS binding

Our TeamCity creates nuget packages of all our branches using NuGet versioning syntax.

Octopus uses the nuget-version as the release version. I created a channel for deploying feature branches and i want to use the branchname part of the release-version as the hostname for the IIS binding.


Nuget-package name:

IIS hostname:

Is is possible in any way?


Thanks for getting in touch!

We expose the channel name in the #{Octopus.Release.Channel.Name} variable and you can use this to populate the hostname in your IIS binding.

Hope that helps!

Thank you and best regards,

Hey Henrik

Thanks for your reply. Its not the Channelname, but the releasenumber i need, so i think i should use Octopus.Release.Number. But only a part of the versionnumber.

If the versionnumber is 1.0.125-fasterbackend how to get only the last part? Is i possible to use some kind of Regex on the variable?


Ah, sorry, I misread your initial post as you had a channel per feature branch, but that’s not the case.

You could use a regex to get the feature branch name, something like the below:

$version = "1.0.125-fasterbackend"
$version -match "\d.*-(.*)"
$matches[1]  # should contain 'fasterbackend'

But you wouldn’t be able to use this as part of the variable replacement we do on so you would have to configure the IIS hostname in a post-deploy script, which makes it a bit more complex.

I hope that helps!

Thank you and best regards,