简体   繁体   中英

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

I'm new to the .NET ecosystem and am jumping in with F#, coming from Java-land. I'm trying to wrap my head around the tooling and build process.

My understanding is that MSBuild is the build tool for .NET applications, and that it's build configuration is defined in XML in a .sln and/or .*proj file. Am I correct in assuming that this is analogous to a pom.xml or build.gradle file in java?

Anyways, if MSBuild is the build tool, what exactly is FAKE for? What can FAKE do that MSBuild cannot? Is it just a more friendly 'wrapper' around MSBuild configuration files?

Edit:

I came across a video titled Ionide and the State of F# Open Source Environment , and in it, the main presenter offers a reason why .*proj files are still needed in VSCode, at least. The following is not a direct quote, but near the end, he says something like

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.

Well, the idea of Fake is that there is more to a build than just compilation . A typical Fake setup delegates the actual compilation to MSBuild, and takes care of the tasks that surround it: running tests, packaging, deploying, etc. While it is technically possible to do these things within MSBuild, its XML syntax and idiosyncrasies can make it a really painful experience. So it is generally best to keep the .*proj purely declarative (listing source files, references and properties) and to use Fake to describe the sequence of tasks that compose a build, where one of those tasks is to invoke MSBuild to perform the compilation.

As for why we still tend to use MSBuild as an intermediary instead of directly invoking the compiler from Fake, it's mostly because IDEs rely on .*proj as a project description format, and invoke MSBuild themselves when you click "Build", so we want to ensure consistency between compiling from IDE and building from the command line.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM