Pascal Caffet Pascal Caffet - 1 year ago 111
C# Question

How do I pass my own custom arguments to build.ps1?

I tried build.ps1 -SettingsProfile "Customer", but it outputs

More than one build script specified.

In my Cake script I fetch via

Argument("SettingsProfile", "Default")

And if I skip the argument to build.ps1 then it'll work, but obviously becomes "Default".

Answer Source

I assume you’re using the default boostrapper. If so there’s a -ScriptArgs parameter you can use to pass your custom Cake arguments.

Cake arguments are not formatted like standard PowerShell parameters (-Key value) but as --Key="value" As such your scenario would look like this

.\build.ps1 -ScriptArgs '--SettingsProfile="Customer"'

Your Cake script argument usage looks fine, so above modification should solve your issue.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download