ArgumentStringHandler blocks usage of variables #1164
-
Usage Information7.0.0, NET 7.0 DescriptionArgumentStringHandler does not allow variables to be passed as arguments. Reproduction Stepsvar cloneCommand = "clone https://github.com/nuke-build/nuke.git"; Expected BehaviorThere have to be an overload allowing to pass strings. Actual BehaviorArgument is 'value' while parameter is declared as 'ref' Regression?Yes. It's a completely avoidable breaking change. Known WorkaroundsNo response Could you help with a pull-request?No |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 4 replies
-
FYI, this has been discussed here: #1007 From the upcoming blog post:
|
Beta Was this translation helpful? Give feedback.
-
I ran into trouble here too - I couldn't get it to work as expected... Before: var heatArguments = $"dir {serverOutputPath} " +
"-nologo " +
// <snip/>
$"-out {heatGeneratedWxsFile}";
var wiXHeatTool = ToolResolver.GetPackageTool("wix", "heat.exe");
wiXHeatTool(heatArguments); After: var wiXHeatTool = ToolResolver.GetNuGetTool("wix", "heat.exe");
var heatArguments = new ArgumentStringHandler();
heatArguments.AppendLiteral($"dir {serverOutputPath} ");
heatArguments.AppendLiteral("-nologo ");
// <snip/>
heatArguments.AppendLiteral($"-out {heatGeneratedWxsFile}");
wiXHeatTool(ref heatArguments); The only thing that I could get to work (though I didn't spend too long on it) was to directly call the |
Beta Was this translation helpful? Give feedback.
-
Will duplicate my message here. Might be useful. Was struggling with the upgrade from 6.3.0 to 7.0.0 After the upgrade the parameter of the node was double quoted by default. NodeExe($"{yarnCommand}", workingDirectory: path, logger: LogErrorAsWarning); NodeExe($"{yarnCommand:nq}", workingDirectory: path, logger: LogErrorAsWarning); Am I doing something wrong? |
Beta Was this translation helpful? Give feedback.
Will duplicate my message here. Might be useful.
Was struggling with the upgrade from 6.3.0 to 7.0.0
After the upgrade the parameter of the node was double quoted by default.
NodeExe($"{yarnCommand}", workingDirectory: path, logger: LogErrorAsWarning);
I had to add the nq format.
NodeExe($"{yarnCommand:nq}", workingDirectory: path, logger: LogErrorAsWarning);
I guess it should have been the default option.
Am I doing something wrong?