The three must-haves for C# developers

Tony Patton says these are the basic items a developer will need on a C# project. Let us know if you'd add anything to his list.

All developers have their favorite utilities and tools, but what if you could have only three? As I explained in my article on the top tools for ASP.NET developers, it is not easy to trim it down to just three.

Now I'm listing my top three tools for C# development; these tools encompass everything from developing a console application to a web service. For starters, I choose tools outside of the IDE with my personal preference being Visual Studio. I group my three selections for C# into unit testing, version control, and something to handle building your code.

Test as you go

Nobody plans to build code that does not work as planned, but it happens. For this reason, code must be thoroughly tested, beginning with testing code as you build it. This begins with unit testing, which means testing small pieces of code to make sure it works as planned. You test the code outside of the overall application, so you can rest assured when everything is assembled that the smaller pieces behave as expected. Using this approach means you develop code with unit testing in mind.

Visual Studio includes unit testing features, but I have been a fan of NUnit for quite some time. While it takes some time to become familiar with NUnit, there are a great number of resources available on the web as well as books and a strong user base. The NUnit framework is included in the project facilitating the development of code for testing alongside application code, and the Visual Studio Unit Test Generator includes NUnit support.

If you do not use NUnit, there are plenty of other options, such as xUnit.

Build it and they will come

Building and deploying code can be a tedious process, but it is often redundant as well; that is, building it once usually follows the same steps as all of the other builds. A build tool provides a way to automate the build process, thus freeing up valuable developer time. Beginning with .NET Framework 2.0, Microsoft included MSBuild as a standard component -- Visual Studio uses MSBuild when it builds solutions. You can use it from the command line or via the Visual Studio interface.

MSBuild allows you to document the steps required to build a solution, including rules and conditions based on the environment. It all starts with a project file where items like what to compile, where to send the output, and so forth are defined. One great aspect of MSBuild is it is a standard Microsoft component, so you can be sure it is on target systems (as long as they are Windows based).

There are plenty of other options available if MSBuild is not your choice; NAnt is one of the more popular options out there.

Keeping track of versions

Application code quickly evolves during the development phase, but it can also change after rollout with changes made to address issues or add features. Unfortunately, changes often need to be rolled back where previous versions of application files are necessary. For this reason, version control is a critical aspect of all development, whether you are a lone developer or working on a team spread out across the world.

In my opinion, the best source control option available is Git. I know I included it in my ASP.NET tools article, but it is critical for all development. Two of the best features of Git is that it is freely available and widely supported. It is easy to use via Visual Studio integration as well as using the command-line interface.

Honorable mentions

It is hard to stick with just three tools (four if you count Visual Studio). Here are three tools that were on the cusp of making the cut, but their scopes were not as broad as the ones listed.

  • Testing web services is not always straightforward, but a tool like Storm is a great help.
  • Working with log files can be a tedious and difficult task, but it is greatly simplified with the freely available Log Parser from Microsoft.
  • Visual Studio provides tools for comparing files in recent versions, but I still like the open source WinMerge tool for quickly finding the differences between two files. 

Only as good as your tools

During a recent home renovation project, a contractor told me that doing a good job relies on using the correct tool as much as the knowledge of what to do. Application development is no different than hanging drywall or laying tile in the sense that you need the right tools to facilitate the work.

Unit testing, version control, and automated builds, along with a good IDE, are keys to churning out quality code and applications. I will not say that my list is all inclusive, but it does cover the basic items needed on a C# project.

What tools do you find indispensable? What tools can you not live without? Let us know in the discussion.