Autoquoting of property args in command strings (eg DotNet Publish)

Hi,

I noticed some strange behaviour in the auto quoting of command line args for the DotNet Publish action. I am trying to pass assembly attribute values as properties to MSBuild via dotnet publish. To set the copyright statement in the assemblies, I am using (more or less) -p:Copyright=Copyright My Client Ltd. 2020 in the additional arguments field of the DotNet Publish action. Actually I was using an expression variable that evaluates to that, but the literal works as an MWE.

Continua appears to be auto quoting part of the argument such that the generated command string contains -p:Copyright=Copyright "My Client Ltd. 2020". This leaves a stray token and causes dotnet publish to throw ‘error MSB1008: Only one project can be specified’.

If I explicitly quote the property value -p:Copyright="Copyright My Client Ltd. 2020" then I get -p:Copyright="Copyright "My Client Ltd. 2020"" in the logged command, with the same result.

I can work around this by passing the properties as action-specific environment variables.

cheers,
Stu

Hi @stuy,

Our argument parser expects MSBuild parameters in the format /p:Name=Value. This works, although I now see the it is written as -p:Name=Value in the docs. It must have been changed since we implemented this (there was a lot of changes in the initial versions). We’ll look into this further on Monday, meanwhile try the /p:Name=Value format.

Hi Dave,

I did try try that initially as that’s what the hint text in the DotNet Publish additional parameters textbox suggests. However, /p:Copyright=Copyright generates /p /p:Copyright=Copyright in the logged command, and dotnet throws an error about a malformed /p arg. If I omit the /p (so just Copyright=Copyright) then the build runs, but the property is not passed and I get a warning about that. Sorry, I had forgotten about this and it really should be a separate issue.

cheers,
Stu

Obviously we need to do some work on this. We’ll get onto it first thing on Monday. Thanks for reporting.

1 Like

Hi @stuy,

We’ve now fixed up the issues parsing the Additional Arguments field for the DotNet actions. You can download a hotfix using the following links:

1 Like