Building .Net Core project in Bamboo
Asked by Sanjay:

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.


Answers:
author: Jimmy Seddon
body: Hi [@Sanjay](/t5/user/viewprofilepage/user-id/2552992),

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

comments: author: Sanjay
body: 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"\>


author: Jimmy Seddon
body: 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](https://community.atlassian.com/t5/image/serverpage/image-id/55252i17D98A8604E671A2/image-dimensions/516x227?v=v2 "NewCapability.JPG")

I hope that helps!

-James


author: Sanjay
body: 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


author: Jimmy Seddon
body: 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.


author: Sanjay
body: 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?


author: Jimmy Seddon
body: 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.


author: Sanjay
body: 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


author: Sanjay
body: Also tried to build the solution using Dotnet.exe and the build was successful.


author: Jimmy Seddon
body: 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.


author: Sanjay
body: 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)


author: Jimmy Seddon
body: 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.


author: Sanjay
body: 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


author: Jimmy Seddon
body: Hey [@Sanjay](/t5/user/viewprofilepage/user-id/2552992) ,

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

Have a great day!

-James


author: Ramasamy
body: Hello [@Jimmy Seddon](/t5/user/viewprofilepage/user-id/512822),

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**](https://confluence.atlassian.com/bamboo/configuring-remote-agent-capabilities-using-bamboo-capabilities-properties-289276849.html "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\>**

<br />

**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](https://community.atlassian.com/t5/image/serverpage/image-id/70777i7CC29F2C8FB7ECB4/image-size/large?v=v2&px=999 "bamboo-capabilities.properties.png")

![Bamboo Executable task.png](https://community.atlassian.com/t5/image/serverpage/image-id/70779i250BCAC685B834F3/image-size/large?v=v2&px=999 "Bamboo Executable task.png")

References :

1.[https://confluence.atlassian.com/bamkb/list-of-default-keys-for-the-bamboo-capabilities-properties-file-946025256.html](https://confluence.atlassian.com/bamkb/list-of-default-keys-for-the-bamboo-capabilities-properties-file-946025256.html?_ga=2.172606496.2045902144.1572244447-2020759197.1570794317)

2.[https://confluence.atlassian.com/bamboo/configuring-remote-agent-capabilities-using-bamboo-capabilities-properties-289276849.html](https://confluence.atlassian.com/bamboo/configuring-remote-agent-capabilities-using-bamboo-capabilities-properties-289276849.html?_ga=2.172606496.2045902144.1572244447-2020759197.1570794317)

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


author: Jimmy Seddon
body: Hi [@Ramasamy](/t5/user/viewprofilepage/user-id/3609604),

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](https://community.atlassian.com/t5/image/serverpage/image-id/70814i0463991F5A7AB94B/image-dimensions/556x296?v=v2 "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


author: Ramasamy
body: [@Jimmy Seddon](/t5/user/viewprofilepage/user-id/512822)

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.