<p>I currently use nant, ccnet (cruise control), svn, mbunit. I use msbuild to do my sln build just because it was simpler to shell out. </p>

<p>Are there any merits to switching my whole build script to MSBuild? I need to be able to run tests, watir style tests, xcopy deploy. Is this easier?</p>

<p><strong>Update: Any compelling features that would cause me to shift from nant to msbuild?</strong></p>

[{'answer_id': 10639, 'author': 'Brad Leach', 'author_id': 708, 'author_profile': 'https://Stackoverflow.com/users/708', 'pm_score': 3, 'selected': False, 'text': "<p>I feel that MSBuild and Nant are fairly comparable. If you are using one of these, I generally wouldn't switch between them unless there was a compelling feature that was missing in the product you had selected.</p>\n\n<p>I personally use MSBuild for any new project, but your mileage may vary.</p>\n\n<p>Hope that helps!</p>\n\n<p><strong>Edit:</strong> @ChanChan  - @Jon mentions that Nant doesn't build .NET 3.5 applications. This may be enough of a reason to either change, or at least use them in parallel. As I've moved more towards MSBuild, I am probably not the most informed person to highlight any other showstoppers with either technology.</p>\n\n<p><strong>Edit:</strong> It appears Nant now builds .NET 3.5 Applications.</p>\n"}, {'answer_id': 10641, 'author': 'DevelopingChris', 'author_id': 1220, 'author_profile': 'https://Stackoverflow.com/users/1220', 'pm_score': 1, 'selected': False, 'text': '<p>@Brad Leach</p>\n\n<blockquote>\n  <p>I generally wouldn\'t switch between them unless there was a compelling feature that was missing </p>\n</blockquote>\n\n<p>what are the compelling reasons to use msbuild? are there cons? </p>\n\n<p>So far I\'m getting a pretty good, "no don\'t bother" from your answer.</p>\n'}, {'answer_id': 10645, 'author': 'Jon Limjap', 'author_id': 372, 'author_profile': 'https://Stackoverflow.com/users/372', 'pm_score': 0, 'selected': False, 'text': "<p>I use MSBuild <em>alongside</em> Nant, because the current version of Nant can't as yet compile .NET 3.5 applications (same was true when .NET 2.0 first came out).</p>\n"}, {'answer_id': 10657, 'author': 'AdamSane', 'author_id': 805, 'author_profile': 'https://Stackoverflow.com/users/805', 'pm_score': 0, 'selected': False, 'text': '<p>The only reason I can see for using msbuild is if you would like to use a automated build server like cruise control. If you are not going to switch, then I would leave it alone.</p>\n'}, {'answer_id': 10726, 'author': 'Andrew Grant', 'author_id': 1043, 'author_profile': 'https://Stackoverflow.com/users/1043', 'pm_score': 1, 'selected': False, 'text': "<p>I think they're relatively comparable both in features and ease of use. Just from being C# based I find msbuild easier to work with than nants, though that's hardly a compelling reason to switch.</p>\n\n<p>What exactly is nant not doing for you? Or are you just hoping there's some cool feature you may be missing out on? :)</p>\n\n<p>One super-nice thing about C# is that if you have the .net framework, you have everything you need to run msbuild. This is fantastic when you are working on large teams / projects and have people/hardware turnover. </p>\n\n<p>Personally I prefer SCons over both of them :)</p>\n"}, {'answer_id': 10737, 'author': 'Lance Fisher', 'author_id': 571, 'author_profile': 'https://Stackoverflow.com/users/571', 'pm_score': 6, 'selected': True, 'text': '<p>I like MSBuild.  One reason is that .csproj files are msbuild files, and building in VS is just like building at the command line.  Another reason is the good support from TeamCity which is the CI server I\'ve been using.  If you start using MSBuild, and you want to do more custom things in your build process, get the <a href="http://msbuildtasks.tigris.org/" rel="noreferrer">MSBuild Community Tasks</a>.  They give you a bunch of nice extra tasks.  I haven\'t used NAnt for several years now, and I haven\'t regretted it.</p>\n\n<p>Also, as Ruben mentions, there are the <a href="http://www.codeplex.com/sdctasks" rel="noreferrer">SDC Tasks</a> tasks on CodePlex.</p>\n\n<p>For even more fun, there is the <a href="http://www.codeplex.com/MSBuildExtensionPack" rel="noreferrer">MSBuild Extension Pack on CodePlex</a>, which includes a twitter task.</p>\n'}, {'answer_id': 12298, 'author': 'Adam', 'author_id': 1341, 'author_profile': 'https://Stackoverflow.com/users/1341', 'pm_score': 4, 'selected': False, 'text': '<p>The most compelling reason to use MSBuild (at least in .NET 3.5 and beyond) - the build engine can build concurrently.</p>\n\n<p>This means a huge speed up in your builds in you have multiple cores/processors.</p>\n\n<p>Previous to 3.5, MSBuild didnt do parallel builds.</p>\n'}, {'answer_id': 12313, 'author': 'Jim', 'author_id': 1208, 'author_profile': 'https://Stackoverflow.com/users/1208', 'pm_score': 5, 'selected': False, 'text': "<p>My advice is just the opposite - Avoid MSBuild like the plague.  NANT is far far easier to set up your build to do automatic testing, deploy to multiple production environments, integrate with cruisecontrol for an entry environment, integrate with source control.  We've gone through so much pain with TFS/MSBuild (Using TFSDeployer, custom powershell scripts, etc) to get it to do what we were able to do with NANT out of the box.  Don't waste your time.</p>\n"}, {'answer_id': 12317, 'author': 'Dale Ragan', 'author_id': 1117, 'author_profile': 'https://Stackoverflow.com/users/1117', 'pm_score': 1, 'selected': False, 'text': "<p>The main reason I still use nAnt over msbuild for my automated builds is that I have more granular control on my builds.  Due to msbuild using the csproj has it's build file, all the source in that project is compiled into one assembly.  Which causes me to have a lot of projects in my solution for large projects where I am separating logic.  Well with nant, I can arrange my build where I can compile what I want into multiple assemblies from one project.</p>\n\n<p>I like this route, because it keeps me from having to many project files in my solution.  I can have one project with folders splitting out the layers and then use nant to build each layer into it's own assembly.</p>\n\n<p>However, I do use both nant and msbuild in conjunction for some build tasks, like building WPF applications.  It is just a lot easier to compile a WPF application with the msbuild target within nant.</p>\n\n<p>To end this and the point of my answer is that I like to use them side by side, but when I use msbuild in this configuration, it is usually for straight compiling, not performing any build automation tasks like copying files to a directory, generating the help documentation, or running my unit tests for example.</p>\n"}, {'answer_id': 328604, 'author': 'Jess Chadwick', 'author_id': 13960, 'author_profile': 'https://Stackoverflow.com/users/13960', 'pm_score': 1, 'selected': False, 'text': '<p>I\'m actually still trying to figure this question out myself, but there is one big bonus for MSBuild here: using the same build file for local continuous integration by calling msbuild.exe directly, while also being able to use VSTS\'s server-side continuous integration with the same build file (albeit most likely different properties/settings).</p>\n\n<p>i.e. as compared to TeamCity\'s support for MSBuild scripts, VSTS <strong><em>only</em></strong> supports MSBuild scripts! I\'ve hacked around this in the past by exec\'ing NAnt from MSBuild; I\'ve seen others recommend this practice as well as the reverse, but it just seems kludgey to me, so I try not to do it if I can avoid it.  So, when you\'re using "the full Microsoft stack" (VSTS and TFS), I\'d suggest just sticking with MSBuild scripts.</p>\n'}, {'answer_id': 339804, 'author': 'mirkov', 'author_id': 43122, 'author_profile': 'https://Stackoverflow.com/users/43122', 'pm_score': 2, 'selected': False, 'text': "<p>We also switched from nant to msbuild. If Your build is pretty standard, then You won't have much problems setting it up, but if You have a lot of specific build tasks, You will have to write custom ms build tasks, as there are way less custom tasks for msbuild. </p>\n\n<p>If you want to display reasonable build results, You will have to mess with custom loggers etc. The whole team build is not as ripe as nant is.</p>\n\n<p>But the real benefit is integration with TFS source control and reporting services. If You are not using TFS as Your source control system, it's not worth it.</p>\n"}, {'answer_id': 555521, 'author': 'David Keaveny', 'author_id': 319980, 'author_profile': 'https://Stackoverflow.com/users/319980', 'pm_score': 2, 'selected': False, 'text': "<p>NAnt has been around longer, and is a considerably more mature product, and also IMO easier to use. There is a lot of community know-how out there to tap into, and it is also cross-platform, should you be interested in building apps that can run under Mono as well as .NET and Silverlight. Out of the box, it does a whole lot more than MSBuild does. Oh yes, and you can call MSBuild from NAnt (OK, from NAntContrib) :-)</p>\n\n<p>On the negative side, NAnt and its sister project NAntContrib do seem to have stagnated, with the most recent update being late 2007.</p>\n\n<p>The main advantages that I see of MSBuild is that it ships with the .NET Framework, so it's one less product to install; and there is more active development going on (albeit in places to catch up with the older NAnt).</p>\n\n<p>Personally, I find its syntax a little more difficult to pick up, but then I'm sure continued exposure to ti would make things easier.</p>\n\n<p>Conclusion? If you're working with existing NAnt scripts, stick with them, it's not worth the hassle of porting. If you're starting a new project, and you're feeling adventurous, then give MSBuild a go.</p>\n"}, {'answer_id': 693814, 'author': 'Konstantin Tarkus', 'author_id': 82686, 'author_profile': 'https://Stackoverflow.com/users/82686', 'pm_score': 1, 'selected': False, 'text': '<p><strong>Nant</strong> has more features out of the box, but <strong>MSBuild</strong> has a much better fundamental structure (item metadata rocks) which makes it much easier to build reusable MSBuild scripts.</p>\n\n<p>MSBuild takes a while to understand, but once you do it\'s very nice.</p>\n\n<p>Learning materials:</p>\n\n<ul>\n<li><a href="https://rads.stackoverflow.com/amzn/click/com/0735626286" rel="nofollow noreferrer" rel="nofollow noreferrer">Inside the Microsoft Build Engine: Using MSBuild and Team Foundation Build</a><br>\nby Sayed Ibrahim Hashimi (Jan, 2009)</li>\n<li><a href="https://rads.stackoverflow.com/amzn/click/com/B001D25YT6" rel="nofollow noreferrer" rel="nofollow noreferrer">Deploying .NET Applications: Learning MSBuild and ClickOnce by Sayed</a><br>\nby Y. Hashimi (Sep, 2008)</li>\n</ul>\n'}, {'answer_id': 739889, 'author': 'Ash', 'author_id': 43192, 'author_profile': 'https://Stackoverflow.com/users/43192', 'pm_score': 2, 'selected': False, 'text': "<ul>\n<li>Don't switch unless you have a very convincing reason (at least).</li>\n<li>NAnt is open source and if it weren't I wouldn't be able to customize our build system, MSBuild is not.</li>\n<li>NAnt can easily run MSBuild, I'm not sure about the other way around.</li>\n<li>MSBuild scripts are already written for you if you use VS2005 or newer (the project files <strong>are</strong> MSBuild files.)</li>\n<li>If you use NAnt, and you use VS to edit project files, settings and configurations, you'll have to write a converter/sync tool to update your NAnt files from the VS Project files.</li>\n</ul>\n"}, {'answer_id': 873069, 'author': 'ferventcoder', 'author_id': 18475, 'author_profile': 'https://Stackoverflow.com/users/18475', 'pm_score': 1, 'selected': False, 'text': '<p>I don\'t see any reason to switch. MsBuild itself locks you into the framework you are using. If you use NAnt, you can use it across many frameworks and shell out to msbuild to actually do the building task for you.</p>\n\n<p>I am a fan of NAnt in this respect, because it decouples you from the framework a little bit.</p>\n\n<p>I have created a framework that puts conventions into automated builds and I built it on NAnt. It\'s called UppercuT and it is the insanely easy to use Build Framework.</p>\n\n<p>Automated Builds as easy as (1) solution name, (2) source control path, (3) company name for most projects!</p>\n\n<p><a href="http://code.google.com/p/uppercut/" rel="nofollow noreferrer">http://code.google.com/p/uppercut/</a></p>\n\n<p>Some good explanations here: <a href="http://ferventcoder.com/category/10094.aspx" rel="nofollow noreferrer">UppercuT</a></p>\n'}, {'answer_id': 1579393, 'author': 'Ludovic Chabant', 'author_id': 105861, 'author_profile': 'https://Stackoverflow.com/users/105861', 'pm_score': 1, 'selected': False, 'text': '<p>MSBuild being integrated with Visual Studio gives programmers less friction to use the build system. It mainly comes down to them only having to go "Build Solution" and it all works, versus having to use Custom Build Steps and other such things, or, worse, forcing developers to build by launching some kind of external script.</p>\n\n<p>Now, I mostly tend to prefer MSBuild over NAnt because it\'s simpler. Sure, NAnt has a lot more features, is more powerful, etc., but it can quickly get out of hand. If you and your build engineers have the discipline to keep the NAnt scripts simple, then it\'s all good. However, I\'ve seen too many NAnt-based systems go south to a point where nobody understands what it\'s doing anymore, and there\'s no real way to debug it besides doing the equivalent of a good ol\' printf. The moment you start using some if/else statement or for loop, that\'s where, IMHO, it starts smelling.</p>\n\n<p>On the other hand, MSBuild has a solid foundation based on metadata and a less verbose syntax. Its simplicity (or lack of features... depending on how you see it) forces you to write logic in .NET code via new tasks, instead of writing logic in XML markup. This encourages re-usability and, above all things, lets you actually debug your build system in a real debugger.</p>\n\n<p>The only problem with MSBuild is the not-so-occasional bug (especially in the first version) or obscure (although documented) behaviour. And, if that\'s the kind of thing that really bothers you, being tied to Microsoft.</p>\n'}, {'answer_id': 3023792, 'author': 'Chuck Conway', 'author_id': 17360, 'author_profile': 'https://Stackoverflow.com/users/17360', 'pm_score': 1, 'selected': False, 'text': "<p>I switched from NANT to MSBuild. The project is running in .Net 4.0. </p>\n\n<p>My experience in Nant was good. The project kind of died. And when .Net 4.0 came along, it was time to re evaluate the build process. </p>\n\n<p>Since Nant was last released MSBuild has come along ways. At this point, MSBuild is the way to go. It's easy to use, has many extensions. I rewrote my Nant scripts in a day and a half. The MSBuild script is 1/3 the size of the Nant scripts. </p>\n\n<p>Much of the work in the Nant script was setting up the different environments. In MsBuild/.Net 4.0 it's built-in. </p>\n"}, {'answer_id': 11726403, 'author': 'Kat Lim Ruiz', 'author_id': 915865, 'author_profile': 'https://Stackoverflow.com/users/915865', 'pm_score': 0, 'selected': False, 'text': "<p>I use Nant and I love it. I used MSBuild and hated it because of these:</p>\n\n<ol>\n<li><p>Microsoft forces you to follow their own build procedure that is so intrinsic to their doings that I at least was not able to make it work (I had to compile NET1.1 so I had to mix Nant and MSbuild). I know you can create your own MSBuild file, but I thought it was complex to understand and maintain.</p></li>\n<li><p>ItemTypes to do file operations are just too hard to follow. You can have Nant do the exact same things and much easier and direct (I had to create an ItemType list and then pass to the file operations).</p></li>\n<li><p>In MsBuild you have to create your own task dll, in Nant you can do this or you can embed C# code within your script, so its much easier to advance and just build the whole project.</p></li>\n<li><p>Nant works with Net1.1, MsBuild doesn't.</p></li>\n<li><p>To install nant, I can even unzip and locate inside my own repository to run it. To install MsBuild is much harder since it depends on many things from Visual Studio, etc. (maybe I'm wrong here, but that seems to be the truth).</p></li>\n</ol>\n\n<p>Well these are my opinions...</p>\n"}]
['https://Stackoverflow.com/questions/10634', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1220/']