Skip to content

Improve ToolTask's usage of response files #4315

@fadimounir

Description

@fadimounir

In relation to dotnet/sdk#3121

We need a way to:

  1. Have a ToolTask implementor to specify a custom response file path (via a property override for example)
  2. Boolean property to enable the logging of the tool command using the @"rspfile" format (Ex: mytool.exe @"temppath\myrsp.rsp") instead of the default list of raw arguments.

Regarding the first point, there are some cases where we need to keep the response file around in the obj intermediates. This is especially useful in repros, where we need to quickly reproduce a tool failure for investigation, and it has proven useful when we ask our customers to submit us repros for external bug investigations.

Regarding the second point, there are 2 aspects here:

  1. Aesthetic aspect: there are some tools that require huge commands, and can make it very hard to read the msbuild log. I'm not talking about enabling/disabling the logging here, which can be controlled by the msbuild logging verbosity (that's a different thing). I'm talking about logging the exact command that is being executed, which is based on a response file instead of the huge list of raw arguments. Not just would it be easier to copy/paste that command from the msbuild log for a targeted repro, but it would make the log so much easier to read. On another note, given that we can split various raw arguments over multiple lines in the response file, it makes the response file so much easier to read with a human eye compared to a huge string of concatenated raw arguments. Best example: all the /r arguments for the C# compiler.
  2. Correctness aspect: we need to know exactly the command that executed. If a tool fails because of a bug in response file argument parsing, there would be no way of easily reproducing that just by copying/pasting the raw arguments logged in the msbuild log.

An example of a tool where we really benefitted from keeping the rsp files and logging the rsp-based command can be found here: dotnet/sdk#3121

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions