本文介紹了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,選擇哪一個以及何時選擇?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!
【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!