.NET projects



Is Circle CI having the ability to deal with .NET projects ?

If yes, Could you tell me how ?
If no, why doesn’t it support the .Net ?

Support for .NET


We do not officially support .NET

Some users have had luck with the mono framework which you can install via circle.yml

Another interesting idea would be to try running .NET inside of docker.


Now its clear that circleCI does not support .NET builds. May I know the reason ?


.NET is a Windows technology, and CircleCi is running on Linux machines.

The only way to build .NET is to try using mono or docker, as mentioned above.

Since building Windows projects on Linux machines tends to be somewhat tricky, it’s not something CircleCi has chosen to support at this time.


OK, Understood.
Thank you so much for the reply.


Now that .NET Core 1 (which runs on Linux) is released, will this change?


While I would have to defer to CircleCi staff to see if they plan on changing their support policy, I have confirmed that the sample project at https://www.microsoft.com/net/core#ubuntu works flawlessly under CircleCi…


Hi @drazisil. Thanks for confirming this. Out of interest, how did you get this working? I managed to get something up and running with the following circle.yml file:

    - sudo sh -c 'echo "deb [arch=amd64] https://apt-mo.trafficmanager.net/repos/dotnet/ trusty main" > /etc/apt/sources.list.d/dotnetdev.list'
    - sudo apt-key adv --keyserver apt-mo.trafficmanager.net --recv-keys 417A0893
    - sudo apt-get update
    - sudo apt-get install dotnet-dev-1.0.0-preview2-003121
    - dotnet restore
    - dotnet test ./UnitTest/

Note that you have to set your build environment settings to use Ubuntu 14.04 for this to work.

I’d be interested to know if @drazisil found a simpler way to do this?

Also, it would be good to hear from Circle staff if there are plans to support this out-of-the-box in the future?



Build url: https://circleci.com/gh/drazisil/fun-with-circle/193
circle.yml: https://github.com/drazisil/fun-with-circle/blob/testing-dotnet-core/circle.yml

I hadn’t checked, but yes, this project is set to Ubuntu 14.04

It looks like you ran the unit tests, something I forgot. Otherwise it looks almost exactly the same :slight_smile:


I have a problem with your circle.yml, using Ubuntu 14.04.

Failed to resolve library symbol hostfxr_load, error: /usr/share/dotnet/host/fxr/1.0.1/libhostfxr.so: undefined symbol: hostfxr_load
Failed to resolve library symbol hostfxr_unload, error: /usr/share/dotnet/host/fxr/1.0.1/libhostfxr.so: undefined symbol: hostfxr_unload
This executable relies on newer functionality (exports) provided by 'libhostfxr.so'
  - Updating 'libhostfxr.so' to version '1.0.2-beta-000581-00' might help resolve this problem.

I have copied too the following circle.yml, but the problem persists.

- “hwapp”

- sudo sh -c ‘echo “deb [arch=amd64] https://apt-mo.trafficmanager.net/repos/dotnet/ trusty main” > /etc/apt/sources.list.d/dotnetdev.list’
- sudo apt-key adv --keyserver apt-mo.trafficmanager.net --recv-keys 417A0893
- sudo apt-get update
- sudo apt-get install dotnet-dev-1.0.0-preview2-003121

- mkdir hwapp
- cd hwapp
- dotnet new
- dotnet restore
- dotnet run
- echo “done”


The error message you are getting mentions updating libhostfxr to a specific version. Try adding - sudo apt-get install dotnet-hostfxr-1.0.2-beta-000581-00 to your circle.yml file after - sudo apt-get install dotnet-dev-1.0.0-preview2-003121. Hope that helps!


It’s resolved my problem.


FWIW, I set up a project using this config now, which seems to work quite well. The build takes about 2 minutes once the NuGet packages have been cached (the 2nd build):


    - sudo sh -c 'echo "deb [arch=amd64] https://apt-mo.trafficmanager.net/repos/dotnet-release/ trusty main" > /etc/apt/sources.list.d/dotnetdev.list'
    - sudo apt-key adv --keyserver apt-mo.trafficmanager.net --recv-keys 417A0893
    - sudo apt-get update
    - sudo apt-get install dotnet-dev-1.0.0-preview2.1-003177
    - dotnet restore
    - ~/.nuget

    - dotnet build


Now it’s also possible to use docker images with the official ms built and runtime images to built .net core apps.
Use microsoft/aspnetcore-build to build the project and microsoft/aspnetcore to host / run it.

Some further reading regarding this : Exploring ASP.NET Core with Docker in both Linux and Windows Containers


I am also looking into options to use Circle Ci with .NET apps but older .NET versions so no .Net Core. As far as I can see Circle Ci 2.0 supports custom Docker images. There is now also a Windows Server Core edition docker image available which supports .NET 3.5 and 4.x


It is fairly easy to create a working build w/CircleCI 2.0, since it is pretty much just a modified Dockerfile.

version: 2
      - image: microsoft/dotnet:2-sdk
    working_directory: ~/repo

      - checkout

      - run:
          name: NUnit Tests
          command: dotnet test MyProject.Test

My problem is what do I use for nuget cache key? Since I would need to hash all the .sln & .csproj files.