For the last 8 years, Jet Brain’ Resharper has been a must have add-on to Visual Studio for me and many other .NET developer’s. Simply put, the productivity and features that Resharper provides enables me to write quality code, faster and with less bugs than by using Visual Studio alone. When I started working on Open Source projects a couple of years back at Couchbase, nothing change: Resharper and Visual Studio remain my primary tools.

In this post I’ll go over some of the features that I believe make the Resharper and Visual Studio combination a win!

Running Unit Tests

One thing that Visual Studio has lacked is first class support for 3rd party Unit Test Frameworks, such as NUnit; instead you are forced into using MSTest (although support was added in later years for other frameworks if you have the correct license). Additionally, depending upon you license you may not even have the ability to run Unit tests directly from the IDE. You simply right click on the project and select “Run Unit tests”. Resharper adds support for running Unit Tests from the context menu if you are using NUnit or MSTest; there are plugins for other 3rd party libraries such as xUnit.net. Importantly, it’s “frictionless”: right click, “run unit tests” or CTRL + U, R. Boom. Tests are running!

A couple of cool and useful features that I use quite a bit are:

“Show Time”: The ability to enable timings for each test which is very helpful for identifying slow tests which may indicate issues for further investigation or refactoring.

“Track Running Tests”: will show the running test at the top of the current Session dialog. This make it easy to see which test is currently in progress.

These are both just toggled on/off from the unit test Session Dialog:

In the image above, the “paw” is the “Track Running Tests” toggle and the “clock” is the “Show Time” toggle. Cool stuff.

Refactoring

Refactoring is one thing that Resharper excels in. Most of the features that Resharper have seem to be borrowed from the Java world of Eclipse or Intellj, which makes switching between IDE’s easier. The refactoring features I use most often are:

“Rename”: rename a method, Type or namespace

“Change Signature”: safely change the signature of a method

“Push member up”: make an existing method, field or property a member of a base class or interface

“Extract Interface/Super Class/Class” – make the a new Type from the existing type

The refactoring features make it easy to make changes to large class libraries without fear of introducing bugs. The refactoring allows you to review proposed changes and also cancel the changes if you detect a conflict. In addition, Resharper will make recommendations based off “Code Smells” and warnings and offer quick fixes. In general these are spot on, but you must ensure that the proposed change doesn’t have any or side effects and or matches your intention. If not you can ignore the recommendation and provide a hint to Resharper to tell it to longer warn or suggest the change to you.

Namespace Suggestions

I am not sure what the exact feature is called, but I like it! What is it? Well, when you start typing the name of a type you wish to use in your code or when you cut and paste code from an example and want to try out, the project may not have references to it or the file may not have the correct using statements. This feature will inspect your project and try to reconcile the using statement to add.

This makes it so much easier to get up and running. I can’t tell you how many times I have answered forum questions where a user simply cannot find the reference. You can also use this as a development tool to create classes, properties, etc. while you write your Unit tests or other code. Very useful.

Conclusion

For me, Resharper is a must have add-on for Visual Studio. Without it, I simply don’t feel as productive as I could be. In a way I feel like I am coding with blinders on, I simply don’t have the information (about the code) and tools I need to succeed. I only went over a handful of features, but those are the ones that I use most often and the ones that I feel add the most value. If you haven’t tried Resharper, take it for a spin; you may just find that missing addition to Visual Studio that makes your productivity skyrocket and your code quality increase.