Building C++ project using ms build in BitBucket pipeline

Basavaraj B S January 15, 2024

Hi Team,

I am trying build the C++ project through Bit Bucket Yaml pipeline, i have installed all necessary tools like VS,MSbuild but its throwing me this error.msbuild error.PNG

1 answer

1 vote
Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 17, 2024

Hi Basavaraj,

Based on your screenshot, it looks like you are using a Windows Runner for Pipelines. Windows Runners use PowerShell to run pipeline steps on your Windows machine (host device). The error you get indicates that PowerShell does not recognize the MSBuild command.

Can you try running that command outside of a Pipelines build? Try cloning the repo on that machine, then use PowerShell to navigate to the repo directory and run the command that is failing. This is to narrow down if the issue is specific to the Pipelines runner or not.

If you face the same issue outside of the runner, you can check the following StackOverflow question and its answers on how to use MSBuild in PowerShell:

If you're still experiencing issues, you can also check Microsoft's Q&A and ask a question about how you can use MSBuild in PowerShell:

Kind regards,
Theodora

Basavaraj B S January 17, 2024

Hello @Theodora Boudale 

I found out that the environment I set up the host machine was insufficient to build (i.e as per my understanding  ms build was recognising ,visual studio was not installed efficiently ).

Now I am able to run the pipeline which is recognizing the necessary supportive tools, But I am facing the following challenges.

 

  

I am trying to build the bit bucket yaml pipeline written in C++ - MFC .

 Pipeline.yaml.png

When I am trying run the pipeline it is throwing the error (image attached).

error.png

I am running the runners in my host machine environment which is setup with Visual Studio 2019 (installed necessary MFC, C++ build, MS Build).

Based on my online search, the suggestion provided was to ensure correct UNICODE settings, and I have configured them appropriately according to my understanding. When attempting to locally build this project using Visual Studio 2019, it compiles without any issues.

Based on my online search ,the error C2039 occur when the Unicode Character is not Set , But in my host machine setup I have set Unicode Character

Is there a connection between the runner's setup on the host machine and the pipeline? Is it mandatory to have Visual Studio installed on the host machine, or is the MS Build file alone sufficient for pipeline builds? What are the prerequisites necessary for building the pipeline of a C++ project?

 unicode character set.png

I am seeking guidance on resolving this matter so that I can successfully build the C++ project using the Bitbucket YAML file pipeline.

Theodora Boudale
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 19, 2024

Hi Basavaraj,

Windows Runners use PowerShell to run pipeline steps on your Windows machine (host device). The only prerequisite for a build on a Windows runner is that any tools required for the build are installed on the host machine and also that the commands you have in your yml file can run on PowerShell.

The question of which tools need to be installed on the host machine for specific projects and any build-specific errors are outside the scope of our support. The relevant question here is, does this build run on PowerShell outside of the runner?

If it doesn't, then the question is, how do you make this build run on PowerShell? This is something that you can ask at a forum or the support team of the tools you are using.

You can rule out if this is a runner-specific problem by following these steps:

  • Clone the repo on that host machine using PowerShell
  • Navigate to the repo directory
  • Run the commands from your yml file

If the commands fail as well, then this is not a runner-specific issue. You first need to make these commands work in PowerShell, and then they should work with the Windows runner.

If the commands don't fail on PowerShell but fail when using the runner, then we would need to see the commands and full output of the successful command that was run on PowerShell, outside of the runner, and also of the failed command with the runner.

Kind regards,
Theodora

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS
AUG Leaders

Atlassian Community Events