本文介绍了NAnt 或 MSBuild,选择哪一个以及何时选择?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我知道还有其他 NAnt 和 MSBuild 有关 Stack Overflow 的相关问题,但我找不到两者之间的直接比较,所以这里是问题.
I am aware there are other NAnt and MSBuild related questions on Stack Overflow, but I could not find a direct comparison between the two and so here is the question.
什么时候应该选择 NAnt 而不是 MSBuild?哪个更适合什么?NAnt 更适合家庭/开源项目,MSBuild 更适合工作项目吗?两者中的任何一个是什么体验?
When should one choose NAnt over MSBuild? Which one is better for what? Is NAnt more suitable for home/open source projects and MSBuild for work projects? What is the experience with any of the two?
推荐答案
这周我做了一个类似的调查.以下是我能够确定的:
I've done a similar investigation this week. Here's what I've been able to determine:
NAnt:
- 跨平台(支持 Linux/Mono).例如,将网站安装到多个目标(即 Linux Apache 和 Windows IIS)可能会很方便.
- 95% 的语法与 Ant 相似(当前的 Ant 用户或 Java 构建者很容易上手)
- 与 NUnit 集成以在构建过程中运行单元测试,并与 NDoc 集成以生成文档.
MSBuild:
- 内置于 .NET.
- 与 Visual Studio 集成
- 在 Visual Studio 中轻松开始使用 MSBuild - 这一切都在幕后进行.如果您想更深入,可以手动编辑文件.
主观差异: (YMMV)
- NAnt 文档更简单一些.例如,MSBuild 任务参考 列出了Csc 任务 - 描述 Csc任务及其参数."(感谢帮助"?),与 NAnt 任务参考csc - 编译 C# 程序."更新:我注意到 MSBuild 文档 得到了改进,现在好多了(可能与 NAnt 相当).
- 很难弄清楚如何直接从 Visual Studio 中编辑构建脚本源(*.*proj 文件).使用 NAnt,我只需让 Visual Studio 将 .build 脚本视为 XML 文件.
- 显然,在 Visual Studio 中,Web 应用程序项目默认不会获得 *.*proj 文件,因此我很难弄清楚如何让 MSBuild 在我的服务器上运行以创建部署脚本.
- NAnt 不是 Visual Studio 内置的,必须通过加载项或作为外部工具"添加.设置起来有点麻烦.
- ()我的一位同事提出了这个问题——如果你想使用 CruiseControl<设置构建机器/a> 对于持续集成,CruiseControl 与 NAnt 完美集成,开箱即用.更新: CruiseControl 还有一个 MSBuild任务.
- 有关主观差异的完整和最新讨论,请参阅下面的评论.
- NAnt documentation is a little more straightforward. For example, the MSBuild Task Reference lists "Csc Task - Describes the Csc task and its parameters. " (thanks for the "help"?), vs the NAnt Task Reference "csc - Compiles C# programs." UPDATE: I've noticed the MSBuild documentation has been improved and is much better now (probably on par with NAnt).
- Not easy to figure out how to edit the build script source (*.*proj file) directly from within Visual Studio. With NAnt I just have Visual Studio treat the .build script as an XML file.
- Apparently, in Visual Studio, Web Application Projects don't get a *.*proj file by default, so I had great difficulty figuring out how to even get MSBuild to run on mine to create a deployment script.
- NAnt is not built-in to Visual Studio and has to be added, either with an Add-In, or as an "External Tool". This is a bit of a pain to set up.
- () One of my coworkers brought this up--if you want to set up a build machine using CruiseControl for continuous integration, CruiseControl integrates with NAnt nicely out of the box. UPDATE: CruiseControl also has an MSBuild task.
- Please see comments below for full and up-to-date discussion of subjective differences.
这篇关于NAnt 或 MSBuild,选择哪一个以及何时选择?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!