How to access Bamboo variables in an msbuild task

I am trying to create a new msbuild task. I would like to use some of the Bamboo variables in the task (specifically bamboo.repository.revision.number in this case, but I have the same problem in other cases). I have set up the build to diagnostic verbosity (/v:diag) so I can see all the environment variables. Any Plan variables I have manually created show up in the environment, but none of the built-in variables show up.

I have tried setting the variables in the Plan varaibles section, but that does not seem to work. I have tried setting them on the Options and that did not work. I have tried using both %...% and ${...} syntax in both fields on the MSBuild configuration page.

So, how do I set up the MSBuild task to any Bamboo global/build/project variables are available to the build script?

3 answers

You misspelled "revision" in the question, is it possible you misspelled it in your MSBuild task?

I've checked, it is spelled correctly, but that is not the problem.

Note: the /v:diag option to MSBuild shows all environment variables for that build. None of the bamboo variables listed in their documentation appear in the list of environment variables available to to build. The manually created variables are present, but not the automatic variables.


I had the same problem but I had "Invalid value for 'AssemblyVersion' " in my log. 

problem was the version number. I used something like:  v.,  turns out I need to remove the "v." 

I can confirm that ${} works . 


Good luck.

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published May 18, 2017 in Bamboo

FAQ: How to Upgrade Bamboo Server

Bamboo 5.9 will no longer be supported after June 12, 2017. What does this mean? As part of our End of Life policy, Atlassian supports major versions for two years after the first major iteratio...

1,805 views 0 6
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you