Modern Build Automation for C#/.NET- Matthias Koch
@matkoch87@nukebuildnet
Background● Used MSBuild
○ But XML isn’t very handy
● Used PowerShell○ Lots of unknown unknowns
● Skipped FAKE○ Learning curve of new language
● Used CAKE○ Still scripting
10 Ingredients for an
AKEless* Build System
© Nikolai Norman Andersen
ingredients[0] =
"Console Application"
ingredients[1] =
"CLI Tool Support"
Fluent API
Specification
Composition I
Composition II
Lightweight Resolution
Lightweight Resolution
Tool Dependencies
ingredients[2] =
"Path Handling"
Division Operator Magic
ingredients[3] =
"Value Auto-Injection"
ingredients[4] =
"Target Model"
Target Definitions● Compile depends on Restore
○ DependsOn(Restore)
○ DependentFor(Compile)
● Restore must run after Clean○ Before(Restore)
○ After(Clean)
● Publish triggers Announce○ Triggers(Announce)
○ TriggeredBy(Publish)
● Cleanup must always run○ AssuredAfterFailure()
● Announce must not stop execution○ ProceedAfterFailure()
● Conditions○ OnlyWhenStatic(() => true)
○ OnlyWhenDynamic(() => false)
● Skip behavior○ WhenSkipped(Behavior.Skip)
○ WhenSkipped(Behavior.Execute)
Dependency Graph
ingredients[5] =
"CI Integration"
Collapsing
Configuration Generation
Artifacts
Artifacts
Parameters
Partitioning
ingredients[6] =
"IDE Extensions"
ingredients[7] =
"Global Tool"
$ dotnet tool install Nuke.GlobalTool --global
Applied changes (after setup)
ingredients[8] =
"Build Sharing"
Strategies● Git Submodules
● NuGet Packages
● External Files
● .NET Global Tools
● Default Interface Members?
Global Tools
dotnet pack
_build.csproj _build.nupkg
External Files
Build.tmp
Build.cs.ext
Build.cs
nuke
ingredients[9] =
"Community"❤
Ask Me Anything