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

This widget could not be displayed.

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

This widget could not be displayed.

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.

This widget could not be displayed.

Doug,  

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.5.0.9.100,  turns out I need to remove the "v." 

I can confirm that ${xxx.xxx.xxxxxx} works . 

 

Good luck.

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Tuesday in Jira

What modern development practices are at the heart of how your team delivers software?

Hey Community mates! Claire here from the Software Product Marketing team. We all know software development changes rapidly, and it's often tough to keep up. But from our research, we've found the h...

150 views 1 3
Join discussion

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