nmake vs MSBuild
nmake 和 msbuild都是两种命令行自动编译系统,功能大同小异。现在的vs 2005已经采用了msbuild系统。
nmake的格式采用的是比较直白的,文件很简单:
proxy.obj: ..\proxy.c ..\putty.h ..\network.h ..\proxy.h ..\puttyps.h \
..\misc.h ..\windows\winstuff.h ..\mac\macstuff.h \
..\macosx\osx.h ..\unix\unix.h ..\puttymem.h ..\tree234.h \
..\windows\winhelp.h ..\charset\charset.h
cl $(COMPAT) $(CFLAGS) $(XFLAGS) /c ..\proxy.c
而msbuild使用的是xml文件:
<Compile Include="Form1.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Form1.Designer.cs">
<DependentUpon>Form1.cs</DependentUpon>
</Compile>
对比二者,虽然msbuild是后起之秀,但感觉他相比前者更难于用手工编辑,如果纯粹是用ide维护这个文件当然没问题,但是却给需要手动配置的开发者制造了麻烦。需要阅读/输入冗长的xml tag。msbuild可能有带来很多创新,但是不得不遗憾得说他更加远离人类了。
而且网上也有人开始抱怨:
I’ve been looking into MSBuild recently. It’s nice, seems to do a good job, and handles the normal tasks that one would expect from a build manager. But I can’t figure out why it was necessary for Microsoft to develop this tool.
Granted, the build process in Visual Studio 2003 was rather opaque, so a better solution was necessary. However, a standard build system has existed for decades in the form of ‘make’ programs. Microsoft even has its own make utility…namely NMAKE. The NMAKE program has been around for many years.
MSBuild has some nice features such as In-Process Tasks, Metadata, and Conditionals. But these are merely small additions to a build management process that really hasn’t changed between the old makefiles and the new MSBuild system. MSBuild uses all the same concepts as makefiles. Specifically, it still deals with targets, dependencies, file lists, and commands. Rather than develop a whole new build system, the additional new features could have easily been added as extensions to the NMAKE language. However, rather than update NMAKE, Microsoft instead decided to reinvent the wheel (something that most organizations strive to avoid). Moreover, the MSBuild project files are XML. This makes it much easier for MSBuild to parse the files, but they are much more difficult for humans to read than are makefiles. It also puts a significant burden on a large number of developers the world over to learn a new tool, and a new project file language. Was the ability to more easily parse the file worth the extra effort that is now required of untold thousands of developers? It seems like this was something that should have been avoided.
posted on 2009-03-24 10:10 smwikipedia 阅读(1491) 评论(0) 编辑 收藏 举报