MSBuild 和 F# 的 FAKE 有什么区别?

What is the difference between MSBuild and F#'s FAKE?

我是 .NET 生态系统的新手,正在使用 F#,来自 Java-land。我正在努力思考工具和构建过程。

我的理解是 MSBuild 是 .NET 应用程序的构建工具,它的构建配置在 .sln and/or .*proj 文件的 XML 中定义。我是否正确地假设这类似于 pom.xml 或 build.gradle 文件 java?

无论如何,如果 MSBuild 是构建工具,那么 FAKE 到底有什么用? FAKE 能做什么而 MSBuild 不能?它只是对 MSBuild 配置文件更友好 'wrapper' 吗?

编辑:

我看到了一个标题为 Ionide and the State of F# Open Source Environment 的视频,在视频中,主讲人提供了至少在 VSCode 中仍然需要 .*proj 文件的原因。以下不是直接引用,但在接近尾声时,他说了类似

的话

The MSBuild system is not needed at all in terms of communicating with the compiler and getting your code to work. The only reason we can't toally pull it out yet is because the F# compiler service - which provides the tooltip info, certain type of type checking, etc - depends on the project file, but we're working on expanding it so it can use different types of formats.

好吧,Fake 的想法是 build 不仅仅是 compilation。典型的 Fake 设置将实际编译委托给 MSBuild,并处理围绕它的任务:运行 测试、打包、部署等。虽然在技术上可以在 MSBuild 中完成这些事情,但它 XML 语法和特质会使它成为一种非常痛苦的体验。因此,通常最好保留 .*proj 纯声明性(列出源文件、引用和属性)并使用 Fake 来描述构成构建的 tasks 序列,其中之一这些任务是调用 MSBuild 来执行编译。

至于为什么我们仍然倾向于使用MSBuild作为中介而不是直接从Fake中调用编译器,主要是因为IDEs依赖.*proj作为项目描述格式,并自己调用MSBuild当您单击 "Build" 时,我们希望确保从 IDE 编译和从命令行构建之间的一致性。