Building .Net Core project in Bamboo

Sanjay May 21, 2019

Hi,

I am building a new .Net core application on Bamboo. i am getting below error.

error MSB4041: The default XML namespace of the project must be the MSBuild XML namespace. If the project is authored in the MSBuild 2003 format, please add xmlns="http://schemas.microsoft.com/developer/msbuild/2003" to the <Project> element. If the project has been authored in the old 1.0 or 1.2 format, please convert it to MSBuild 2003 format.

Obviously the current MSBUILD 14 is not able to build the .Net core application.

Has anyone came across the same situation? How did you add the new executable (MSBUILD) In bamboo to build .net core projects.

1 answer

1 accepted

0 votes
Answer accepted
Jimmy Seddon
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 21, 2019

Hi @Sanjay,

We are currently in a state of migrating all of our MSBuild projects to .NET Core.  What we have done is installed .NET COre 2.0 on the Bamboo server and we are using a PowerShell script to invoke the .Net Core CLI.

So we end up running:

dotnet.exe build <ProjectFileName> -c Release

to build .Net Core projects.

The error message you have there looks like there is a mis-configuration within the *.csproj file itself, as it references the project element.

The project element in one of our working projects looks like this:

<Project Sdk="Microsoft.NET.Sdk">

It might be worth checking to see if there is there that shouldn't be.

I hope that helps.

-James

Sanjay May 21, 2019

Thanks James for the quick reply.

We are using VS 2019 for our new projects and the project element in *.csproj file is 

<Project Sdk="Microsoft.NET.Sdk.Web">

Like Denys Voznesenskii likes this
Jimmy Seddon
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 21, 2019

hmm.. we haven't moved to VS 2019 yet, we are still running on VS 2017.

Going back to your initial question as that might help you in your specific case you can add a new executable by going to the Admin Cog -> Overview, then click on Server capabilities in the left hand pane.

Scroll down all the way to the bottom and you will see the ability to add new capabilities:

NewCapability.JPG

I hope that helps!

-James

Sanjay May 21, 2019

I know how to add capability but don't know how to add .Net core path.

Where should it be If I install  .NET COre 2.0

Jimmy Seddon
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 21, 2019

I have it installed on our Bamboo server in: C:\Program Files\dotnet

You will want to look for the dotnet.exe as to where you have it installed.

Sanjay May 21, 2019

Oh yes, it's on the location mentioned above. So If give "C:\Program Files\dotnet\dotnet.exe" as the path , it should build correct?

Jimmy Seddon
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 21, 2019

yes it should, if it doesn't I'd try building it outside of Bamboo to see if it works there to try and isolate the problem.

Sanjay May 21, 2019

I have installed the .Net core SDK and gave the path of Dotnet.exe but now its failing with below errors

No executable found matching command "dotnet-@C:\Program Files\Bamboo\temp\Test-JOB1-7-MsBuildTaskType-5755741749793027461.rsp"

Failing task since return code of [C:\Program Files\dotnet\dotnet.exe @C:\Program Files\Bamboo\temp\Test-JOB1-7-MsBuildTaskType-5755741749793027461.rsp] was 1 while expected 0

Sanjay May 22, 2019

Also tried to build the solution using Dotnet.exe and the build was successful.

Jimmy Seddon
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 22, 2019

I almost wonder if the dotnet.exe errors are becuase it doesn't like it being added as an "MSBuild" type executable.  I'd try switching that to a command type executable, and the task to a command type task.  From there you should still be able to pass the same arguments as if you were running it from a command prompt.

Sanjay May 22, 2019

Thanks James,

 

All good except now I am getting 

error NU1102: Unable to find package Telerik.UI.for.AspNet.Core with version(>= 2019.1.220)

Jimmy Seddon
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 22, 2019

Is that a local package your team developed or is it a public package? There are a number of reason that error could be showing up. 

The root of it being that you don't have a copy of that version that the build process is aware of.

I would first make sure that the build log doesn't say anything about failing to retrieve that version of the NuGet package.

If nothing shows up there then start looking at what you have in your NuGet cache for the user that is running the Bamboo server.

Sanjay May 23, 2019

Hi James,

Sorry to took a bit long to reply. The steps we followed to get the .net core projet build using bamboo are

  • we downloded vs_buildtools
  • Installed dotnet-sdk-2.2
  • Installed MSBUILD (version 16)
  • Installed workloads-->.Net core build tools

Added a new capability using MS build 16

Now we have also used Telerik control for ASP.NET Core UI for which we have to add nuget source on bamboo server using below commads

NuGet Sources Add -Name "telerik.com" -Source "https://nuget.telerik.com/nuget" ^
      -UserName "your login email" -Password "your password"

This all made the build successful.

Thank you very much for your time and patience

Regards

Sanjay Shenvekar

Jimmy Seddon
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 24, 2019

Hey @Sanjay ,

I'm glad you were able to figure it out and get things working!

Have a great day!

-James

Ramasamy October 27, 2019

Hello @Jimmy Seddon,

I'm new to bamboo. Right now i have .net core project and i want to automatically deploy it in a server using bamboo.

Rather than adding a executable capability directly from the UI, I want to add a executable capability directly in the remote agent. So i followed the steps mentioned in the page Configuring remote agent capabilities using bamboo-capabilities.properties 

But in configuring remote agent capabilities they stated a format to add the executable capability, the format is

system.builder.<executable type>.<executable label>=<executable path>


For example: i would like to add the executable capability like dotnet(version 3.0.100).

location for my file dotnet is "C:\Program Files\dotnet"

I also tried adding like this "system.builder.dotnet.Dotnet=C:\Program Files\dotnet\dotnet.exe" into a file named "bamboo-capabilities.properties" and moved this file inside the folder "C:\bamboo-agent\bamboo-agent-home\bin". Restarted my remote agent.

After doing this i created a plan and tried to add a executeable task but unfortunately there is no executable task named "Dotnet" is displaying inside my bamboo.

Kind of stuck again & confused. Please have a look at the attached images for your reference. Thanks in Advance.

 

bamboo-capabilities.properties.png

 

Bamboo Executable task.png

References :

1.https://confluence.atlassian.com/bamkb/list-of-default-keys-for-the-bamboo-capabilities-properties-file-946025256.html

2.https://confluence.atlassian.com/bamboo/configuring-remote-agent-capabilities-using-bamboo-capabilities-properties-289276849.html

3.https://community.atlassian.com/t5/Bamboo-articles/How-to-configure-remote-agent-capabilities-using-bamboo/ba-p/1125201

  

Jimmy Seddon
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 28, 2019

Hi @Ramasamy,

I would start by making sure that the Agent actually recognizes that capability you have added.  To be honest, I've personally never used that method to add an agent specific capability.  I've always done it via the web interface.

If you go to the admin cog and select the "Agents" menu option.  Then click on the name of the Agent you wish to inspect, you will be take to a page that looks similar to this:

AgentConfiguration.JPG

What you see here lists all of the Agent specific capabilities.  From here you can use the links I highlighted on the far right to add new capabilities specific to the agent if you don't see them listed there.

This is where I would start.  I hope it helps!

-Jimmy

Ramasamy October 28, 2019

@Jimmy Seddon 

Thanks for your reply. 

The problem is i cannot add a executable capability directly from the UI, I have only permission to add a executable capability directly in the remote agent, this is because I don't have admin rights on a bamboo server (this is due to my company security policy) so I can't view / add / remove agent capabilities. I only have a full access to the remote agent. 

 

with regards,

Ramasamy.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events