根据FAKE文档,您可以通过使用参数--listTargets(或者-lt)执行FAKE来列出构建文件中的所有现有目标:
> ./build.sh --listTargets
build.sh是ProjectScaffold的包装脚本。
https://fsharp.github.io/FAKE/specifictargets.html
我的FAKE版本是:
> ./build.sh --version
FakePath: ...
FAKE - F# Make "4.16.1"
当我运行listTarget命令时,我得到一个奇怪的输出:
Error parsing command line arguments. You have a mistake in your args, or are using the pre-2.1.8 argument style:
Exception Message:unrecognized argument: '--listTargets'.
在错误消息的末尾,我得到了我想要的信息:
Attempting to run with pre-version 2.18 argument style, for backwards compat.
Available targets:
- Clean
Depends on: []
- Build
Depends on: ["Clean"]
- CopyBinaries
Depends on: ["Build"]
- RunTests
Depends on: ["CopyBinaries"]
- Default
Depends on: ["RunTests"]
根据错误消息,我得到的印象是版本2.1.8中的内容根据参数样式发生了变化。
我的问题:使用FAKE列出所有现有目标的正确方法是什么?
这是完整的输出:
> ./build.sh --listTargets
No version specified. Downloading latest stable.
Paket.exe 2.47.1.0 is up to date.
Paket version 2.47.1.0
0 seconds - ready.
Error parsing command line arguments. You have a mistake in your args, or are using the pre-2.1.8 argument style:
Exception Message:unrecognized argument: '--listTargets'.
--envvar [-ev] <string> <string>: Set environment variable <name> <value>. Supports multiple.
--envflag [-ef] <string>: Set environment variable flag <name> 'true'. Supports multiple.
--logfile [-lf] <string>: Build output log file path.
--printdetails [-pd]: Print details of FAKE's activity.
--version [-v]: Print FAKE version information.
--fsiargs [-fa] <string> ...: Pass args after this switch to FSI when running the build script.
--boot [-b] <string> ...: Boostrapp your FAKE script.
--break [-br]: Pauses FAKE with a Debugger.Break() near the start
--single-target [-st]: Runs only the specified target and not the dependencies.
--nocache [-nc]: Disables caching of compiled script
--help [-h|/h|/help|/?]: display this list of options.
**************************************************
Type: System.ArgumentException
HResult: -2147024809
Source: Argu
TargetSite: Nessos.Argu.ParseResults`1[Cli+FakeArg] Nessos-Argu-IExiter-Exit[ParseResults`1](System.String, Microsoft.FSharp.Core.FSharpOption`1[System.Int32])
StackTrace
**************************************************
at Nessos.Argu.ExceptionExiter.Nessos-Argu-IExiter-Exit[b] (System.String msg, Microsoft.FSharp.Core.FSharpOption`1 _arg1) <0x30ab2b8 + 0x00027> in <filename unknown>:0
at Nessos.Argu.ArgumentParser`1[Template].Parse (Microsoft.FSharp.Core.FSharpOption`1 inputs, Microsoft.FSharp.Core.FSharpOption`1 xmlConfigurationFile, Microsoft.FSharp.Core.FSharpOption`1 errorHandler, Microsoft.FSharp.Core.FSharpOption`1 ignoreMissing, Microsoft.FSharp.Core.FSharpOption`1 ignoreUnrecognized, Microsoft.FSharp.Core.FSharpOption`1 raiseOnUsage) <0x2d47288 + 0x00332> in <filename unknown>:0
at Cli.parsedArgsOrEx (IEnumerable`1 args) <0x70a390 + 0x000cb> in <filename unknown>:0
Attempting to run with pre-version 2.18 argument style, for backwards compat.
Available targets:
- Clean
Depends on: []
- Build
Depends on: ["Clean"]
- CopyBinaries
Depends on: ["Build"]
- RunTests
Depends on: ["CopyBinaries"]
- Default
Depends on: ["RunTests"]
更新
我刚刚发现了一个GitHub问题,该问题引用了我的问题,但我对它没有任何意义: