7

I'm finding it difficult to understand Microsoft's motive behind building conceptual "projects" like this. They ship MSBuild.exe and NMAKE.exe together with a Visual Studio 2015 install but they both appear to serve the same purpose.

If they are both (in a practical sense) equivalent but using different formats, I won't bother learning how to write both. If they both have their own purposes, I might reconsider.

The following text is just my current theory on the whole thing... but I asked this question because there could be people here with experience customizing these files unlike myself...

It seems like MSBuild is made for those that depend heavily on the Visual Studio environment (.sln files) for compilation. And upon reading a little bit about it, I asked myself: Couldn't compilation of dependencies be separated by different projects allowing for partial compilation when using MSBuild? That would involve having multiple projects in a solution and then building the solution to build the entire product.

As you can see... I'm trying to understand the philosophy of MSBuild and why it's needed in the build process. At the moment, I'm starting to wonder if it's actually based on NMAKE and compiles down into NMAKE commands. That would make a whole lot of sense because I cannot see why anyone would need both in the same build process.

1
  • 3
    As a side note if you're using C++: don't bother learning any of these things. If you have VS 2015, then edit the properties using the dialog (or perform bulk search/replace in the project files, but that's about then only time you should open such a file in a text editor). Use CMake (or an equivalent tool). This will take care of generating msbuild/make/xcode/... projects. Then these files (whether msbuild or any other type of makefile) are an implementation detail - don't waste your time deciphering them, unless it's for fun, of course. My 2 cents.
    – user44761
    Commented Jan 8, 2016 at 9:41

1 Answer 1

7

Both fulfill the same purpose of controlling and automating complex build processes. However, MSBuild is more modern, has more capabilites, and it integrates much (!) better into the build process of the Visual Studio IDE (both use actually the same "input file format" like csproj and sln files). Those project files can actually be edited and maintained (at least,to 98%) by a well structured "project properties" dialog. That is not possible easily with nmake files, because NMake was never designed for this purpose.

IMHO NMake is shipped with Visual Studio because of backwards compatibility, because of better cross platform compatibility, and because it is sometimes better suited for tasks where you have to integrate tools into your build process which are completely outside the VS IDE. The latter can be accomplished with MSBuild, too, but NMake is IMHO often a better fit if you have to create your build configuration manually - because that is what make was designed for.

NMake was Microsoft's implementation of the Unix make command, which has origins back to 1977, according to Wikipedia. Because of that history, there are still lots of projects using makefiles. Especially in the Unix/Linux world, make is still a widely used tool, and a tool like NMake provides better compatibility to the make tools used in that ecosystem.

Couldn't compilation of dependencies be separated by different projects allowing for partial compilation when using MSBuild? That would involve having multiple projects in a solution and then building the solution to build the entire product.

That is the standard approach for any bigger project, nothing really surprising. But on that abstraction level, it is not different from make/NMake.

2
  • @DavidArno: NMake is at least one or two decades older than MSBuild. But you have a point, changed my answer accordingly.
    – Doc Brown
    Commented Jan 8, 2016 at 9:16
  • And I hadn't realised there were two NMakes, one created by MS long before the one used to simplify Make files. So my answer would have been completely wrong!
    – David Arno
    Commented Jan 8, 2016 at 9:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.