Sample Nuke project used for my blog post "Automate your .NET project builds with nuke a cross-platform build automation solution".
https://youtu.be/o0XLGRObd4E?t=293
- source code
- tests
- build code
Nuke build is a console application
ts entry point is
Main
which by default execute the targetCompile
- Parameter which we can pass to the build
✅ Navigate to the source code IsLocalBuild
✅ Show usage of Configuration
- Solution
✅ Navigate to Solution attribute to show the options
- AbsolutePath
Nice easy way to compose path
- Target
A Target defines a task for your build pipeline and is put in relationship with other targets. For example, Clean runs before Restore and Compile depends on Restore.
✅ Show contextual menu on Clean
✅ Show how to run a Target from context menu with/without dependencies
✅> Code $PROFILE
✅Uncomment
# Nuke build
#Register-ArgumentCompleter -Native -CommandName nuke -ScriptBlock {
# param($commandName, $wordToComplete, $cursorPosition)
# nuke :complete "$wordToComplete" | ForEach-Object {
# [System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', $_)
# }
#}
✅>. $PROFILE
✅ Show auto completion with tab
✅ ntarget
Target Test => _ => _
.DependsOn(Compile)
.Executes(() =>
{
DotNetTest(s => s
.SetProjectFile(Solution)
.SetConfiguration(Configuration)
.EnableNoRestore());
});
✅ > nuke tab tab
nuke --plan
- dotcover
Code coverage tool for tests
partial class Build
GetDotCoverSettings: Fluent API with possibility to specify more arguments with SetTargetArguments
nuke TestWithCoverage
-> Error 💥
✅ Start in debug without dependencies from contextual menu. See exception with useful message. Copy paste first command
nuke :add-package JetBrains.dotCover.DotNetCliTool --version 2021.3.3 nuke TestWithCoverage
Works now!