Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Calling MSBuild using YAML Bamboo Specs

Alexander September 25, 2019

Bamboo Version: 6.9.2

I'm in the process of converting the majority of my organization's plans to use Bamboo's YAML Spec for our build and deployment processes to benefit from all the goodness that configuration-as-code brings to the pipeline.

I'm running into a bit of a snag trying to add a build task that uses MSBuild to compile solution files. I see that I should be able to reference execute capabilities using a script entry (documentation here), but I don't think I'm using the right variable name.

---
version: 2

# <plan-info>

stages:
- Build:
- Build

Build:
tasks:
- clean
# <some-build-steps>
- script: "${system.builder.msbuild.MSBuild v14.0 (32bit)} solution.sln"
# <more-build-steps>
requirements:
- "system.builder.msbuild.MSBuild v14.0 (32bit)"
# <artifacts>
...

It looks like the error is that the ${system.builder.msbuild.MSBuild v14.0 (32bit)} variable isn't being changed to the executable path in the build log's error file:

Capture1.PNG

I've tried to escape the spaces with single/double backslashes (documentation here), but I still get the same error, just with an added backslash after msbuild.MSBuild.

The agent capability does show up in the stage's requirements, so I'm not quite sure what I'm missing in the script entry.

Capture.PNG

If anyone can point me in the right direction, I'd be super grateful! I'm 99% sure that my ${system.builder.msbuild.MSBuild v14.0 (32bit)} variable is the problem, I just don't know how to modify it so that it gets changed to the actual executable path.

1 answer

1 accepted

3 votes
Answer accepted
Alexander September 26, 2019

Good news! I found the problem. Replacing the script entry with the following calls MSBuild successfully.

- script: "\"${bamboo.capability.system.builder.msbuild.MSBuild v14.0 (32bit)}\" solution.sln"

 Thanks to this post here that hinted at what I was missing!

I'd like to suggest to the Atlassian team that the YAML Bamboo Specs documentation be updated to include the bamboo.capability prefix when referencing an executable; it might be obvious to more seasoned Bamboo users, but it would help new users like me out greatly.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events