<p>I simply wondered whether people thought it was worth learning to use the MSBuild syntax in order to customise the build process for a .net project, or whether it is really not worth it given the ease with which one can build a project using visual studio. </p>

<p>I am thinking in terms of nightly builds, etc., but then couldn't I use a scheduled event which uses the command-line build option built into VS? Are there superior tools out there?</p>

[{'answer_id': 47887, 'author': 'Andrew Burns', 'author_id': 3683, 'author_profile': 'https://Stackoverflow.com/users/3683', 'pm_score': 4, 'selected': False, 'text': '<p>@kronoz<br>\nI would say YES.<br>\nThe neat thing about MSBuild is that if you modify your csproj files to include custom build steps then those steps will happen from within VS or from MSBuild.  Also if you ever have a build server you will not need to install full VS, only the SDK to build your projects.</p>\n'}, {'answer_id': 47911, 'author': 'Michael Pryor', 'author_id': 245, 'author_profile': 'https://Stackoverflow.com/users/245', 'pm_score': 3, 'selected': False, 'text': '<p>Well, MSBuild is built in, so if you are doing something simple, then yes, it is recommended.  </p>\n\n<p>But for something like nightly builds, I would suggest <a href="http://finalbuilder.com" rel="nofollow noreferrer">FinalBuilder</a>.</p>\n\n<p>See this <a href="https://stackoverflow.com/questions/672/which-build-configuration-management-tool#830">question on Build/Configuration Management Tools.</a></p>\n'}, {'answer_id': 47952, 'author': 'FlySwat', 'author_id': 1965, 'author_profile': 'https://Stackoverflow.com/users/1965', 'pm_score': 2, 'selected': False, 'text': '<p>MSBuild is incredibly simple to use, you can use VS to manage the projects and solution files and just pass the SLN to MSBuild.</p>\n'}, {'answer_id': 47954, 'author': 'tsimon', 'author_id': 1685, 'author_profile': 'https://Stackoverflow.com/users/1685', 'pm_score': 3, 'selected': False, 'text': "<p>It sounds like you are a single developer working on your own site. If this is the case, it's not necessary at all, but it is still a good idea for you to learn as a part of your professional experience.</p>\n\n<p>Automated building of projects becomes more necessary as the number of developers working on a project increase. It is very easy for two developers to write incompatible code which will break when it is combined (imagine I'm calling a function foo(int x), and you change the signature to be foo(int x, int y): when we combine our code bases, the code will break.</p>\n\n<p>These types of errors increase in complexity and hassle with the amount of time between integration builds. By setting up nightly builds, or even builds that occur every check-in, these problems are greatly reduced. This practice is pretty much industry standard across projects with multiple developers.</p>\n\n<p>So now, to answer your question: this is a skill that will span across projects and companies. You should learn it to broaden your knowledge and skills as a developer, and to add an important line on your resume.</p>\n"}, {'answer_id': 108691, 'author': 'Jay Bazuzi', 'author_id': 5314, 'author_profile': 'https://Stackoverflow.com/users/5314', 'pm_score': 1, 'selected': False, 'text': "<p>Building from the command line with MSBuild  is relatively easy to learn.  Start by opening a Visual Studio Command Prompt, and running <code>msbuild /?</code>.  Just read through the help once and then decide later if you want to learn more details.</p>\n\n<p>Writing project files is a bit more complicated.  Most people don't need to learn it, because you can do most things in Visual Studio.  However, it's also quite powerful for certain problems.  </p>\n\n<p>I have in the past used MSBuild as scripting language, combined with lots of custom tasks.  MSBuild has fantastic logging support + built-in dependency management.  However, it's not an easy language to learn.  PowerShell is a much better choice.</p>\n"}, {'answer_id': 117865, 'author': 'Jivko Petiov', 'author_id': 11348, 'author_profile': 'https://Stackoverflow.com/users/11348', 'pm_score': 4, 'selected': False, 'text': '<p>MSBuild is absolutely worth the time to learn. After the initial learning curve (which might be very steep actually) it becomes fairly easy to do the most common build automation steps.</p>\n\n<ul>\n<li>building assemblies in RELEASE mode</li>\n<li>signing assemblies with strong name</li>\n<li>running unit tests </li>\n<li>modifying xml files / Web.config-s on the fly</li>\n<li>modifying the version number of the assemblies</li>\n<li>validating FxCop / StyleCop etc... </li>\n<li>automated deployment - create SQL databases, IIS websites, windows services etc...</li>\n</ul>\n'}, {'answer_id': 117897, 'author': 'John Rudy', 'author_id': 14048, 'author_profile': 'https://Stackoverflow.com/users/14048', 'pm_score': 2, 'selected': False, 'text': "<p>In a scenario such as yours, where you do not already have a build system, then yes, MSBuild is absolutely worth it. Not only can you use it for a variety of pre-build and post-build tasks (see Jicko Petiov's answer), but you can also integrate it nicely into a continuous integration environment (such as CruiseControl).</p>\n\n<p>One scenario where it might not be worth it is when you already have an automated/scripted build system in place. For example, I myself haven't taken the time with MSBuild because I've been using NAnt for this task since before MSBuild existed ... </p>\n"}, {'answer_id': 2179262, 'author': 'Scott Lawrence', 'author_id': 3475, 'author_profile': 'https://Stackoverflow.com/users/3475', 'pm_score': 3, 'selected': False, 'text': '<p>MSBuild is definitely worth learning for anyone and everyone writing .NET software.  The reason a build server for .NET apps no longer requires Visual Studio to be installed (as Andrew Burns mentioned) is because MSBuild is part of the .NET Framework now.  </p>\n\n<p>Knowing MSBuild will give you significant flexibility in choosing what technologies you use to implement continuous integration.  Because I took the time to learn MSBuild, I was able to change the CI system one of our teams was using from CruiseControl.NET to TeamCity without much difficulty.  Those CI servers, or something like FinalBuilder (which I\'m not familiar with), are better options for performing nightly builds than a scheduled task. Learning how to implement custom MSBuild tasks will give you even more flexibility in implementing custom builds.  Jivko Petiov listed a number of tasks that MSBuild makes easier.  In the case of database deployment and configuration, I\'ve written scripts that do this in MSBuild, and it makes the development and testing process much easier.</p>\n\n<p>If Visual Studio Team System is in your future, applications built using MSBuild will be much easier to move into that environment than those built via alternative means.</p>\n\n<p>There are a lot of resources available to help you get started with MSBuild.  I\'d start with <a href="https://rads.stackoverflow.com/amzn/click/com/0735626286" rel="noreferrer" rel="nofollow noreferrer">Inside the Microsoft Build Engine</a>.  One of the co-authors also has a ton of stuff on the web, including <a href="http://www.sedodream.com/" rel="noreferrer">this site</a>, and a <a href="http://www.codeplex.com/Sedodream" rel="noreferrer">project on CodePlex</a>.</p>\n'}, {'answer_id': 2362959, 'author': 'JoDG', 'author_id': 84140, 'author_profile': 'https://Stackoverflow.com/users/84140', 'pm_score': 0, 'selected': False, 'text': '<blockquote>\n  <p>@kronoz I would say YES. The neat\n  thing about MSBuild is that if you\n  modify your csproj files to include\n  custom build steps then those steps\n  will happen from within VS or from\n  MSBuild. Also if you ever have a build\n  server you will not need to install\n  full VS, only the SDK to build your\n  projects.</p>\n</blockquote>\n\n<p>==> This is not entirely true. For example, building a setup project on a build server will require Visual studio to be installed!!</p>\n'}, {'answer_id': 14589196, 'author': 'yantaq', 'author_id': 554060, 'author_profile': 'https://Stackoverflow.com/users/554060', 'pm_score': 1, 'selected': False, 'text': '<p>If you develop in .net workshop, It does <strong>worth</strong> learning. <br>\nI have integrated our build process with Jenkins - originally Hudson. \nAs it mentioned above, MSbuild has steep learning curve.However once\nyou grasp the fundamentals, you can start customizing the build.\nmy impression so far - could be naive, bulk of the script is consisted of </p>\n\n<pre><code>&lt;PropertyGroup&gt;\n   &lt;PropertyKey&gt;value&lt;/PropertyKey&gt;\n&lt;/PropertyGroup&gt;\n&lt;ItemGroup&gt;\n   &lt;ItemListKey&gt;List values&lt;ItemListKey&gt;\n&lt;/ItemGroup&gt;\n&lt;Task Source="" Target="" /&gt;\n</code></pre>\n\n<pre>\n    Besides using for build, I successfully used MSBuild to create a module that manages\n    configuration files such as web.config and foo.exe.config files. \n    it is a hybrid module that consists of .net console app, MSBuild script and batch file.\n    what this module does is that during a project upgrade, it will create a XML transform       \n    template with connection strings, endpoints and appSettings from old configuration\n    files. \n    after the project has been upgraded, the module will transform newly deployed  \n    configuration\n    files without affecting any new entries. if you have dozens of configuration files this  \n    is very effective. \n</pre>\n'}]
['https://Stackoverflow.com/questions/47884', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/3394/']