GitVersion icon indicating copy to clipboard operation
GitVersion copied to clipboard

[Feature] Allow to pass extra command line parameters to MSBuild task

Open professor-k opened this issue 3 years ago • 0 comments

Is your feature request related to a problem? Please describe. GitVersion has some command line options that can't be passed via MSBuild task, making it impossible to e.g. use non-default config file with stock nuget tasks.

Detailed Description

Current there is no way to insert into $(GitVersion_ToolArgments) anything besides three predefined options.

Context

In my particular case I want to use different configsfor different builds, which is easy with commandline version, but impossible with MSBuild task. There are more options not available via MSBuild too, though not all of them makes sense to expose (e.g. init or /?). Yet I don't see any reason why user wouldn't want to run msbuild with /diag, /overrideconfig or /l + /verbosity.

Possible Implementation

There are two ways it can be acieved.

  1. MsBuild can receive raw piece of command line and pass it directly to Exec.
    • pros:
      • easy to implement
      • absolute flexibility
      • unlimited forward compatibility for future parameters
    • cons:
      • somewhat higher chance to shoot own leg
      • not that elegant
  2. Add separate MsBuild parameter for every option.
    • pros:
      • more elegant
      • harder to do something wrong
    • cons:
      • more code
      • more documentation
      • no automatic support for future keys

In fact, those approaches are not mutually exclusive, they can easily coexist.

professor-k avatar Mar 01 '22 15:03 professor-k