C# on .NET Core
How to build a C# project in Codefresh
Codefresh can work with any .NET core application very easily as there are official Docker images from Microsoft.
The example C# project
You can see the example project at https://github.com/dotnet-architecture/eShopOnWeb. The repository contains a C# Web project with 3 kinds of tests. It has different tags for each version of .NET Core and has
- a
docker-compose.yml
file for local development - a
tests
directory with all types of tests - a Dockerfile at
/src/Web
There are also previous releases at https://github.com/dotnet-architecture/eShopOnWeb/releases.
Create a CI pipeline for C# applications
Creating a CI/CD pipeline for C# is very easy, because Codefresh can run any SDK image version that you wish.
Here is the full pipeline that compiles the application after checking out the code.
codefresh.yml
This pipeline:
- clones the source code
- Uses the official
mcr.microsoft.com/dotnet/core/sdk:3.0
image to run unit/integration/functional tests in 3 different folders - Builds the application docker image using the root folder as Docker context but with the Dockerfile located at
./src/Web
You can see the resulting image in the image dashboard:
Related articles
C/C++ examples
Codefresh YAML for pipeline definitions
Steps in pipelines
Creating pipelines
How Codefresh pipelines work