Does Bitbucket Pipelines support building .NET applications?

PlanCZero June 3, 2016

This question is in reference to Atlassian Documentation: Bitbucket Pipelines (beta)

I'm wondering is pipelines support to build .net framework? I didn't see .yml config for .net. Please advise.

 

Regards

John Wu

14 answers

1 accepted

3 votes
Answer accepted
Philip Hodder
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 30, 2018

The feature request for Windows/.NET builds is here: https://bitbucket.org/site/master/issues/13452/support-for-native-windows-net-builds-on

Follow that ticket for updates from our team.

9 votes
Michael Dostál February 27, 2018

Hello I would like to ask the same question. Will there be in near future any solution to this? We need to build applications with .net 4.7.1 in pipelines and due to missing TPT inheritance in Entity Framework core we cannot use .netCore images. Thank You for reply

7 votes
Zeno Lee April 30, 2019

Windows has an 80% desktop market share as of 2019 and people are still creating and maintaining desktop applications for it in .NET Framework and C++.  Offering a windows build platform on pipelines would be in Atlassian's benefit.

4 votes
pedromagueija June 21, 2016

If you don't mind using mono, you can as well do:

image: mono

pipelines:
  default:
    - step:
        script:
          - nuget restore
          - MONO_IOMAP=case xbuild /t:Build /p:Configuration="Release" /p:Platform="Any CPU" Solution.sln
Deleted user June 4, 2017

I have tried with this script but I am not able to run the build. I am getting the error near nuget restore. command not found. Please help me

Ing_ Jiří Kočara November 2, 2018

You can use msbuild instead deprecated xbuild

msbuild /t:Clean,Build /p:Configuration=Release 'Solution.sln'
Like # people like this
2 votes
sebastianInones February 22, 2020

@PlanCZero I know you posted this a looong time ago but in case it may help you or others...
In our case, we really like Bitbucket but as we need to "Build" our .NET Framework projects we are using BitBucket and Azure DevOps together. So, we have a Pipeline defined in Azure DevOps getting the source code from BitBucket. 
Therefore, we are able to build our Windows .Net Framework projects in Azure Devops while still maintaining our code on BitBucket. They both integrate really well and you can get the Build status from both tools ;)

Amandeep Singh April 17, 2020

Hi @PlanCZero  I like this solution with Bitbucket and Azure DevOps but the issue is we are having IP Restriction on bitbucket, Is there way we can whitelist particular repo from IP-Restriction ?

2 votes
James Neave January 7, 2019

Hi,

Here's my "best effort" for testing .Net projects in Pipelines.

So, we know that there is no msbuild support at the moment.

And porting to .Net Core is not a good solution.

However, I've come up with a halfway house.

A way to test your C# with Pipelines, but still output a Full Framework build.

You need Visual Studio 2017

You're going to create new .csproj files for .Net SDK rather than msbuild
You will use the new <TargetFrameworks> node rather than the default, singular <TargetFramework> node

Each DLL has 2 targets by default, the .Net Standard 2.0 and the .Net Full Framework 4.5.1
Each entry project, be it EXE, ASP.Net, etc, also has 2 targets, .Net Core 2.0 and .Net Full Framework 4.5.1

Two unfortunate, serious limitations exist:
1) You can't use Linq To Sql, you have to replace it or buy the drop in replacement LinqConnect by DevArt
2) You must either port your .Net web projects to ASP.Net MVC or Razer (any programming model older than that is not supported in ASP.Net Core) or test your ASP.Net web projects somewhere else

There's other changes, it's too much to list here, but by and large I've found most things "Just Work" until .Net Standard

So, your new DLL csproj files look like this:

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

<PropertyGroup>
<TargetFrameworks>netstandard2.0;net451</TargetFrameworks>
</PropertyGroup>

</Project>

Exe projects look like this:

<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>netcoreapp2.0;net451</TargetFrameworks>
<AssemblyName>MyProj</AssemblyName>
<RootNamespace>RJ.MyProj</RootNamespace>
</PropertyGroup>
</Project>

By default, these include all files in your projects, as opposed to msbuild which includes zero files by default.

There's no GUI support for these project types yet. You need to hand write them. You'll need to put criteria in the references and nuget sections so each framework version has it's own section. You can add as many targets as you like, all the way back to .Net Framework 2.0! When you build these, it outputs (by default) 2 folders under bin. Their names match the target framework.

Once you get this working, you have two set of binaries. One is the full framework and it should be identical to what you built before.
The other binary is .Net Standard or Core and can be spun up and tested inside a .Net Core container in Pipelines.
The logic is that, for your business logic at least, if it passes your tests running under .Net Core, it's equivalent to passing under the full framework.
I'm still learning all this, I've only got to the point of everything compiling and it seems to run under both types of framework.
Most of the information I needed to learn to get this working so far came from this page:
MultiTargeting And Porting a .Net Library to .Net Core 2.0
It's a bit out of date, it's from when all of this stuff was in preview.
I know it's not what people are asking for, but it's the closest you can do without requiring live software to be ported to .Net Core
Good luck everybody! If I ever get an example project together, I'll post that here as well.

2 votes
Sten Pittet
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 5, 2016

Hi John,

One of our customers provided an example of a Bitbucket Pipelines configuration for a .NET Core application. You can find it on Bitbucket.

We do not yet support running pipelines in Windows environment but we're keeping an eye on the work that Docker and Microsoft are doing together.

Thanks,

Sten

1 vote
James Neave May 1, 2019

Hi.

This is not an answer.

However it is a solution.

Look into using .Net Standard 2.0 and up.

Targeting .Net Standard allows your project to multi target .Net Full and .Net Core.

2.0 and up allows you to use most .net tools like MVC, razor and entities frame framework.

Your project can even be set up to produce multiple sets of binaries.

1 vote
Werner October 25, 2017

Still no positive news on that?

1 vote
Jerod Venema March 5, 2017

Any updates to this folks? MS has full docker support these days, when are we going to see that in pipelines?

1 vote
Rodney Joyce February 8, 2017

Are there any Docker images that have MSBuild on? I am having problems with Mono and my .NET solution (I don't use .NET core yet)

1 vote
sbirgisson
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
June 27, 2016

Here are two blog posts about building .Net apps in Pipelines, using the docker image:

image: microsoft/dotnet

http://davevde.github.io/using-bitbucket-pipelines-with-aspnet-core/

http://davevde.github.io/bitbucket-pipeline-with-aspnet-core-and-webpack/

Dave Todaro July 2, 2016

Thanks, @Sigge Birgisson. .NET Core is a bit too "shiny and new" to be adopted for our new client projects.

Do you know of any reference information that would help us understand the build and test running process for ASP.NET 4.x WebAPI solutions using NUnit 3?

Like Lenin Raj likes this
Anders Gustafsson October 26, 2016

@Dave Todaro Have you found any information on how to build ASP.NET 4.x solutions in Bitbucket Pipelines?

Like Lenin Raj likes this
0 votes
Lenin Raj
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 14, 2020
sebastianInones February 22, 2020

That example if for .NET Core and as the original question states is about: ".NET framework".

Like John Hutton likes this
0 votes
devpartisan
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 2, 2017

What build tools do people use for .NET these days? When I last coded C# a couple years back, MS Build was pervasive, like it or not. But we liked to use a layer over it like psake or fake. Are people using those or others?

Rodney Joyce May 2, 2017

I recently reviewed a whole lot of CI tools - I use BB Pipelines for the Node frontend and Visual Studio Team Services for the .NET part. I have to say it has improved a LOT since I last used it a few years ago. The scrum tools are massively improved too. BuddyBuild is a fantastic CI tool but uses Mono for .NET. So I would check out VSTS. When BB comes out of beta I am moving all my Node projects to VSTS

Like Lenin Raj likes this
Marek Ducai December 3, 2017

I have same issue... my app is Console App / Windows Sevrice - 

.net 4.5 app and I would like to get it building in PIPELINEs.. Any chance for using msbuild?

Like Lenin Raj likes this
James Neave April 17, 2018

We're currently evaluating Atlassian's BitBucket, Jira and Pipelines.

Everything's good except we're going to have to use msbuild for, well, everything.

No way we can move to .net core first.

What's the status on msbuild in a windows dock?

Like Lenin Raj likes this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events