## Where communities thrive

• Join over 1.5M+ people
• Join over 100K+ communities
• Free without limits
##### Activity
• 19:34
matkoch closed #623
• 19:34
matkoch commented #623
• 18:58
• 18:58
matkoch commented #619
• 11:37
laurentkempe opened #623
• 04:52
arodus opened #622
• 04:42
arodus opened #621
• 02:24
matkoch commented #618
• 01:57
matkoch commented #618
• Dec 04 23:32

matkoch on develop

• Dec 04 23:30

matkoch on 5.0.1

Regenerate Fix TeamCity to consider artifa… (compare)

• Dec 04 23:11

matkoch on develop

TeamCity change in 'teamcity.co… (compare)

• Dec 04 20:52
Yglioh commented #618
• Dec 04 19:56
Yglioh commented #618
• Dec 04 19:41
matkoch edited #620
• Dec 04 19:40
matkoch labeled #620
• Dec 04 19:40
matkoch opened #620
• Dec 04 18:38
matkoch commented #618
• Dec 04 18:36
matkoch commented #618
• Dec 04 15:24
matkoch opened #619
Andrew-Archon
@Andrew-Archon
Will lightweight CLI integration work with gradle? It's not an exe, it's launched from a shell script or batch file
Matthias Koch
@matkoch
batch should work
Sam13
@Sam13

nothing is stopping you from extracting methods and marking them virtual

Ok, thanks. Then that's the way to go. I just wanted to make sure if there's another way which I have missed or not understood in the documentation...

nawfalhasan
@nawfalhasan
Is there a way to add alias to Targets? Like if my target is PackNugets, I would like to add a shortcut to it like pn, so that I can execute:
nuke pn
Its hard to remember the whole thing sometimes. Looking up at history is tedious
Matthias Koch
@matkoch
global tool has shell completion
nawfalhasan
@nawfalhasan
I often fire up powershell to execute nuke, I dont get autocompletion there. aliases would have been convenient.
Matthias Koch
@matkoch
Andrew-Archon
@Andrew-Archon
I'm having trouble passing nuke a parameter whose value begins with a hyphen: eg nuke TestTarget --TestValue ---helloworld--- where I want the parameter value to be ---helloworld--- it instead leaves the parameter empty. Is there any way I can get around this? I have tried quoting the value and using --TestValue=---helloworld---
Matthias Koch
@matkoch
quotes?
ahh sry
yes... known issue i think
Andrew-Archon
@Andrew-Archon
Maybe i can add a placeholder at the start and then strip it inside the script haha
Matthias Koch
@matkoch
Duskone39
@Duskone39
hello everyone, using nuke it is really good. But there was a problem, you need to divide the code into separate steps, and then apply different steps in different projects, I have not figured out how to do this using Nuke, can you tell me?
Now it looks like this, is it possible to make each step as ITargetDefinition but at the same time use them as blocks from which to collect different deployment strategies
Matthias Koch
@matkoch
it looks like you’re using another framework inside this
not sure how that fits
Duskone39
@Duskone39
indeed, at first I essentially wrote something nicer for my framework internally, and I don't like it ((but it works for 5 projects in my company
the main question is, is it possible to create a set of Target delegates, move them into a separate library and use a set of delegates from the library for each project (because different projects need different steps and projects more than 30)
2 replies
Duskone39
@Duskone39
also wondering for me how can I sync the logging and posting to Slack (as an example)? if in NukeBuild I could set the OutputSink property, then this is possible, is it planned to give this opportunity to users?
nawfalhasan
@nawfalhasan
@matkoch is there a simple way to execute powershell ps1 file from nuke script?
Johannes Ebner
@Structed
Hey folks!
What's the preferred way in NUKE to make sure NPM is installed?
2 replies
Tim Moore
@tjmoore

Hi, I'm just trying out my nuke'd repository on a system that has no .NET Core installed. I'm running the powershell build.ps1 script with default target/arguments, and it goes off downloading and installing the SDK, then the next step fails...

Microsoft (R) .NET Core SDK version 3.1.302
A fatal error occurred. The required library hostfxr.dll could not be found.
If this is a self-contained application, that library should exist in [D:\dev\XXX\build\bin\Debug\].
If this is a framework-dependent application, install the runtime in the global location [C:\Program Files\dotnet] or use the DOTNET_ROOT environment variable to specify the runtime location or register the runtime location in [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation].

I notice it installs the SDK in the .tmp folder in my repository tree, rather than global. If I run dotnet.exe build from within that against my solution/projects then it builds fine. However if I run the build project which I believe the build scripts do, e.g. .\.tmp\dotnet-win\dotnet.exe run --project .\build\_build.csproj, I get the same error.

Matthias Koch
@matkoch
no idea what hostfxr.dll is
12 replies
Matthias Koch
@matkoch
picks up what?
5 replies
Tim Moore
@tjmoore
Hi, am I right that the build.ps1/.cmd/.sh scripts only installs .NET Core SDK if there is none present on the system? i.e. It's not expected to install a later version if there is already a global install?
Matthias Koch
@matkoch
depends on the global.json
Tim Moore
@tjmoore
Ah, thanks. Okay, trying out things with global.json.
mduszenko
@mduszenko
Hello. Is there a way to combine Nuke with another library to handle command line parsing? We are making a more general tool and build/publish is just one part of it. It does not look right to use Nuke for each command, however, the build automation features it provides are very useful and we want to keep them. Maybe there is a possibility to disable Nuke's command line parsing and pass some arguments to the Execute method directly?
Matthias Koch
@matkoch
why disable? just don’t use it
Frank Kubis
@FrankKubis
Iam trying out nuke for first time and always running into "The process cannot access the file 'C:\Projects\NGCM\SMT.NGC M.LSD\src\SMT.NGCM.PSF\SMT.NGCM.PSF.RMS\SMT.NGCM.PSF.RMS.Contract\obj\Debug\net48\SMT.NGCM.PSF.RMS.Contract.dll' because it is being used by another process." issues using IDE integration (tried Rider and Visual Studio). Closing IDE and using terminal does not face this kinds of errors. Any idea whats wrong? I did no change to Build after setup.
Tim Moore
@tjmoore

I'm still noticing issues with bootstrap and SDK versions. I've got global.json setting 'version' to 3.1.401 currently with 'rollForward' set to 'latestFeature'.

.NET Core SDK is installed by Visual Studio globally. On running build.ps1 it's been picking up the global installed 3.1.401. I've just updated Visual Studio to latest version and it's updated .NET Core SDK, now build.ps1 downloads 3.1.401, but it then goes and runs 3.1.402 for the build, which I'd expect with 'latestFeature'.

PowerShell Core version 7.0.3
dotnet-install: Extracting zip from https://dotnetcli.azureedge.net/dotnet/Sdk/3.1.401/dotnet-sdk-3.1.401-win-x64.zip
dotnet-install: Binaries of dotnet can be found in E:\dev\XXX\.tmp\dotnet-win\
dotnet-install: Installation finished
Microsoft (R) .NET Core SDK version 3.1.402

Welcome to .NET Core 3.1!
---------------------
SDK Version: 3.1.402

Subsequent build

PowerShell Core version 7.0.3
dotnet-install: .NET Core SDK version 3.1.401 is already installed.
dotnet-install: Binaries of dotnet can be found in E:\dev\XXX\.tmp\dotnet-win\
Microsoft (R) .NET Core SDK version 3.1.402
Matthias Koch
@matkoch
Matthias Koch
@matkoch
@/all :mega::shipit: NUKE 0.25.0 IS OUT!!!
• Changed InjectionAttribute to catch exceptions and report as warnings
• Changed ToolPathResolver to ignore casing
• Changed ToolSettings to prefix common properties with Process
• Changed property names in Nuke.Common.targets
• Changed GitRepository to trim refs/heads/ and origin/ from branch names
• Changed ShutdownDotNetBuildServerOnFinish to not log by default
• Changed ShutdownDotNetBuildServerOnFinish to only shutdown on server build
• Added support for interface default implementations
• Added NukeBuild.ExitCode for custom exit codes
• Added ProcessTasks.StartShell to invoke shell commands
• Added ToolSettings.Apply for fluent configurator invocation
• Added ToolSettings.LogFile and LogTimestamp
• Added nuke :fix command to Nuke.GlobalTool for adding missing package downloads
• Added nuke :GetRootDirectory and nuke :GetParentRootDirectory in Nuke.GlobalTool
• Added LatestNuGetVersionAttribute, LatestGitHubReleaseAttribute, LatestMyGetVersionAttribute
• Added GitRepository.Protocol, Commit, and Tags properties
• Added logger delegate to ControlFlow.ExecuteWithRetry
• Added BuildExtensionAttributeBase with Priority property
• Added UnsetVisualStudioEnvironmentVariables by default
• Added TeamCity.BuildVcsNumber property
• Added AppVeyor.Url and PushArtifact members
• Added warning when GitVersion is used with SSH endpoint and NoFetch is disabled
• Added consolidated ReSharperTasks for CleanupCode, InspectCode, and DupFinder
• Added TeamsTasks
• Added SignPathTasks
• Added SignClientTasks
• Added BenchmarkDotNetTasks
• Added CleanupCodeTasks
• Added DotNetTasks.DotNetNuGetAddSource task
• Added OctopusTasks.OctopusBuildInformation task
• Added missing properties in SonarScannerTasks
• Added verbosity mapping attributes for NUnit, OpenCover, and ReportGenerator
• Fixed version check in bootstrapping scripts to rely on dotnet CLI exit code
• Fixed deactivation of multi-level lookup in bootstrapping scripts
• Fixed deactivation of shared compilation in bootstrapping scripts
• Fixed ToolPathResolver to consider all package executable names
• Fixed ToolPathResolver to choose executable based on operating system
• Fixed output/input encoding to use UTF-8
• Fixed NukeBuild.BuildProjectFile property
• Fixed AppVeyor generation for Unix images
• Fixed AzurePipelinensAttribute to allow multiple use
• Fixed AzurePipelines to replace dots in stage name with underscore
• Fixed AppVeyor.UpdateBuildVersion to set environment variable
• Fixed DupFinderTasks.DiscardCost property
• Fixed DotCoverTasks to use double-dashes instead of slashes
• Fixed NpmTasks.CustomLogger to detect warnings in error output
Stefan Bertels
@StefanBertels

Hi, this is an older question and I found no satisfying solution. Maybe there are new options or ideas, so here again:

I have build steps that are packaged as Target which is a good thing because they have Requirements, Dependencies and something to execute.
Now I have a small library of building blocks (Targets) like Test, Compile, Pack, Publish, Install (you probably can guess what they do and that they somewhat depend on each other).

Often I have to add special code to those Targets which means I want to have a new e.g. Pack target where I might add Dependencies, might add Requirements and want to add Code (pre-processing / post-processing).
Currently I try to overridethe old Target (inheritance) but this does not work well.

What I'm looking for is a clean way to compose targets (add things to targets). Obviously one (hard) part is that I want to stay with the original target name. If this cannot be solved, I could live with workaround of giving new names.
But I want to re-use existing target definitions in a way that I can add code that get's execute after and BEFORE the old target code (somewhat aspect orientated programming).

Any suggestions?

Stefan Bertels
@StefanBertels
Pseudocode:
 public override Target Publish => _ => _
.DependsOn(base.Publish.Dependencies)
// .DependsOn(... other targets MY code depends on...)
.Requires(base.Publish.Requirements)
// .Requires(... requirements for MY code ...)
.Executes(() =>
{
// MY preprocessing
// ...
base.Publish.Execute();
// MY postprocessing
// ...
});
or something like
public override Target Publish => base.Publish
// .AddRequirement(... requirements for MY code ...)
// .AddDependency(... other targets MY code depends on ...)
{
// MY preprocessing
// ...
})
{
// MY postprocessing
// ...
});
Volkmar Rigo
@VolkmarR

Hello Stefan. One thing I did in my Build Scripts is to separate Target Definition and Target Implementation.

 public Target Publish => _ => _
.Executes(() => PublishAction());

public virtual void PublishAction()
{
// Implement Publish Target
}

That way you can override the PublishAction without changing the Target Definition.
And you can add additional Targets, that are triggered by existing Targets by using TriggeredBy.

Matthias Koch
@matkoch
@/all :mega::shipit: NUKE 5.0.0 IS OUT!!!
• Fixed version number
Marko Lahma
@lahma
🚀🚀🚀 great work! 🚀🚀🚀
Jérôme Rx
@jrouaix
hello there, is there an easy way to quickly add a command line argument to an existing toolsetting
helm3 has some changes and I now need to add a -n <namespace> param to the HelmGetValues tasks
Jérôme Rx
@jrouaix
found it with settings.SetArgumentConfigurator(args => args.Add("--namespace {value}", ns)). working.
Rahul Rai
how can i pass array of string as parameter in nuke build process , how can i pass string[] from powershell
Denis
@dengia
Hi, I'd like to sign my assembly (dotnet core) with Code Signing certificate. Can't find any example on how to do it. Any tips?
Matthias Koch
@matkoch
search for signtool
Denis
@dengia
:-) I mean any example with nuke?
Matthias Koch
@matkoch
cli tools all follow the same principle
it wouldn’t make much sense to provide examples for each and every tool