Git Product home page Git Product logo

cakeapp's Introduction

CakeApp

A .Net Core solution template using the Cake build system. It provides an initial console project and a corresponding XUnit test project. Furthermore it adds cake build scripts for Windows and Linux.

NuGet NuGet

Template layout

This template creates the following structure on your disk, where CakeApp is replaced by the name of your solution.

|-> CakeApp.sln
|-> src
|   |-> CakeApp.Console
|   |   |-> CakeApp.Console.csproj
|   |   |-> Program.cs
|   |   |-> appsettings.json
|-> test
|   |-> CakeApp.Console_Test
|   |   |-> CakeApp.Console_Test.csproj
|   |   |-> UnitTest1.cs
|-> .gitignore
|-> build.cake
|-> Dockerfile
|-> Readme.md

Prerequisite

Since Cake 0.30.0 the script runner is available as a .Net Core Global Tool. This make the bootstrap scripts build.ps1 and build.sh obsolete.

  • Make sure you have at least the .Net Core SDK version 3.1 installed
  • Install the Cake global tool with: dotnet tool install -g Cake.Tool

Installation of Template

On Windows PowerShell or Linux Shell:

dotnet new -i CakeApp

To uninstall the template run:

dotnet new -u CakeApp

Usage

This section will shortly describe how to use the template.

Create a new solution

To create a new solution based on the template use

dotnet new cake -o [your solution name]

This will create a corresponding Visual Studio solution with the structure described above on your disk. You can now proceed to write your code in the given projects or at more projects if you need so.

Build the solution

To build the solution the Cake build system is used. This template comes with a pre-defined Cake build script build.cake with some default build targets. Of course feel free to alter the script if it doesn't fit all your needs.

To run a build on the PowerShell or Bash type: dotnet cake --target=[target name] or just dotnet cake to run the default target test.

Build Target Description Depends on
PrepareDirectories Ensures that all needed directories for the build are available in your solution directory. -
Clean Cleans your last Cake build and deletes all build artifacts. PrepareDirectories
Restore Restores all NuGet packages in your projects. It will try it up to five times, since sometimes the restore does not work on the first try. -
Build Builds your whole solution with the Release configuration. Restore
Test Runs all Unit test projects in the test folder which project names are ending with Test. Other projects are ignored. The test results *.trx files are put into the testResults folder. Clean, Build
Pack Packages all projects from the src folder into corresponding NuGet packages. The packages are placed in the artifacts folder. Clean, Test
Publish Publishes all projects from src to the artifacts folder. You can use the published projects to run them every where else. Clean, Test
Build-Container Builds a Docker container with the main application and tags the container based on the "Version" tag in the *.csproj file and a given build number (default 0). Futhermore the container gets a "latest" tag. publish
Push-Container Pushes the two container tags (version and latest) into a Docker registry which you have to specify with -dockerRegistry="yourregistry" Build-Container
Default The same as Test. If no target is given, this one is used. Clean, Build

Build the project

To build a usable NuGet package from the template source run: dotnet cake --target=Pack from a Windows machine. You find the built Nuget package under artifacts.

Release-Notes

Release notes can be found here: Release-Notes

cakeapp's People

Contributors

secana avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

cakeapp's Issues

Add gitattributes file

Add gitattributes file to set correct line endings for Linux files. The build.sh needs LF endings.

More flexible pattern to find test projects

I always name my test projects MyApplication_UnitTest and MyApplication_IntegrationTest, but the Cake script currently only allows test projects that end on _Test.
How about using a more flexible pattern to find test projects like *Test (instead of the current *_Test)?

This should still avoid the problem with test util projects that don't contain any tests themselves as their names usually don't end on Test.

If you like, I can create a pull request for this (trivial) change.

CI/CD on VSTS

Use Visual Studio Team Services to

  • Build and test the master branch
  • Deploy to nuget.org if master branch was successfully published
  • (optional) Build and test all other branches but do not publish

Possible problems: No Docker container can be started on VSTS

Test the Linux build with build.sh

Currently the only the build.ps1 is tested on Windows. Test the build.sh on Linux, too.

Add the Linux test to the Test task in the build.cake file

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.