Code-based approach to the Cake (C# Make) build system. Provides a C# build host to use Cake methods, utilities and addins in a .NET application.
This project is not affiliated with Cake, nor supported by the Cake contributors.
- Create or open a NET framework C# project
- Install the Code.Cake NuGet package:
Install-Package Code.Cake
- Create a build host class:
// Cake extension methods and utilities are split into many different namespaces, which all need to be specified.
// They're all on https://cakebuild.net/api/ if you're looking for them.
using Cake.Common.Build;
using Cake.Common.Diagnostics;
using Cake.Common.IO;
using Cake.Common.Tools.NuGet;
using Cake.Common.Tools.MSBuild;
// AddPathAttribute will add directories to the process' PATH environment variable.
// Use it if you have external executables like nuget.exe, octo.exe, etc.
[AddPath("packages/**/tools*")]
public class Build : CodeCakeHost
{
public Build()
{
// The Cake property has all Cake properties, tools and extension methods on it
Cake.Log.Verbosity = Verbosity.Diagnostic;
var binDir = Cake.Directory("bin");
var solutionFile = Cake.File("MySolution.sln");
// Task example
Task("Clean")
.Does(() =>
{
Cake.CleanDirectories(binDir);
});
// Tasks can depend on other tasks, which will be executed before
Task("Build")
.IsDependentOn("Clean");
.Does(() =>
{
Cake.NuGetRestore(solutionFile);
Cake.MSBuild(solutionFile);
});
// If no task is specified when you execute Code.Cake, the "Default" task will be executed
Task("Default")
.IsDependentOn("Build");
}
}
- In your code, call
Code.Cake
;
string[] cakeArgs;
var app = new CodeCakeApplication();
app.Run(cakeArgs);
- Clone the repository
- Using Powershell, execute
CodeCakeBuilder/Bootstrap.ps1
- Execute
CodeCakeBuilder/bin/Release/CodeCakeBuilder.exe
Feed | Code.Cake |
---|---|
NuGet stable | |
NuGet prerelease | |
MyGet preview | |
MyGet CI |
Branch | Visual Studio 2017 |
---|---|
latest | |
master |
Anyone and everyone is welcome to contribute. Please take a moment to review the guidelines for contributing.
Assets in this repository are licensed with the MIT License. For more information, please see LICENSE.txt.
This repository and its components use the following open-source projects:
- cake-build/cake, licensed under the MIT License
- SimpleGitVersion/SGV-Net, licensed under the MIT License