Background
The Cake runner supports a number of arguments, such --version to display the version of the runner, or --debug to launch the script in debug mode.
However, this make it impossible for these names to be used as arguments in Cake build scripts. For example, if one wanted to use the argument version as an input to the build script:
var version = Argument<string>("version");
And then run Cake:
dotnet cake --version=1.2.3
They would receive an error: Flags cannot be assigned a value
Workaround
The current workaround is to use the "remaining arguments" feature when using one of these "reserved" argument names:
dotnet cake -- --version=1.2.3
Proposal
This issue intends to make the necessary updates to allow existing "flag" arguments to be used in build scripts, so that if the user runs cake with --version=1.2.3 do not assume the flag --version and instead execute the Cake script with the argument ["version"] = "1.2.3".
| Command-line |
Expected result |
dotnet cake --version |
Display Cake version (as it is today) |
dotnet cake --version=1.2.3 |
Run build script and set the version argument to 1.2.3 |
This should work for all Cake runner arguments, except for Verbosity which is not a "flag" argument.

Related:
Background
The Cake runner supports a number of arguments, such
--versionto display the version of the runner, or--debugto launch the script in debug mode.However, this make it impossible for these names to be used as arguments in Cake build scripts. For example, if one wanted to use the argument
versionas an input to the build script:And then run Cake:
They would receive an error:
Flags cannot be assigned a valueWorkaround
The current workaround is to use the "remaining arguments" feature when using one of these "reserved" argument names:
Proposal
This issue intends to make the necessary updates to allow existing "flag" arguments to be used in build scripts, so that if the user runs cake with
--version=1.2.3do not assume the flag--versionand instead execute the Cake script with the argument["version"] = "1.2.3".dotnet cake --versiondotnet cake --version=1.2.3versionargument to1.2.3This should work for all Cake runner arguments, except for
Verbositywhich is not a "flag" argument.Related: