by Andreas

Visual Studio 2010 – alternatives to ReSharper

imageJetBrains ReSharper is without a doubt an extremely powerful tool for developers. If you’ve never heard about it or given it a go, I strongly recommend you go ahead and try it out.

That said, there are two camps when it comes to ReSharper: the lovers and the haters. The lovers have become so dependent on it that they claim “Visual Studio feels broken without it” (a quote from my colleague). The haters will spend time out of their day to slam it because it’s not true to “old school programming” and simply does too much for you. Not surprisingly, a lot of them (including me) started their programming careers back when C++ was considered state of the art and intellisense was a word only used by dyslexics.

When I first tried it a few years ago I ended up in the haters camp, although not spending time telling others that they should hate it too. And I have to admit after recently giving it another go with their latest release (which at the time of writing is ReSharper 7) I’m still not entirely convinced. I find it to be just too much, too visually noisy, too “let me do this automatically for you” – simply too annoying. Which sucks, because after installing it I ended up turning off one great feature after another until I was left with some simple code editor improvements, the HTML and Javascript editor improvements and their absolutely brilliant lambda expression converter.

Anyway, the aim of this post is to suggest an alternative for the ones of us that find ReSharper to be too intrusive. The Visual Studio Gallery is a great place to start, and you will find a great selection of plugins that offer you single, isolated features rather than a massive package containing 95% of stuff you simply don’t want. As an example, check these two out:

Productivity Power Tools
http://visualstudiogallery.msdn.microsoft.com/d0d33361-18e2-46c0-8ff2-4adea1e34fef

JScript Editor Extensions:
http://visualstudiogallery.msdn.microsoft.com/872d27ee-38c7-4a97-98dc-0d8a431cc2ed

There are also quite a few plugins for the (at the time of writing) new Visual Studio 2012, and more are added every week.

by Joakim

Delete ReSharper Test Results on “Clean Solution”

On my local dev machine, I can see no reason for keeping old test results (on a build server it’s another matter completely though). You usually run your tests quite often when developing, and thus you get a lot of “test result”-folders cluttering up your hard drive. Some test runners have options for configuring how many old test results you would like to keep, but this is not the case for ReSharper’s test runner (afaik).

To remedy this I’ve created a new target in the project file for my test project, that will delete the test result folder when I right-click the solution Visual Studio’s solution explorer and select “Clean Solution” (or on a project and select “Clean”). By default ReSharper creates the test results in “<ProjectFolder>/bin/<Configuration>/TestResults”, you can however change this (and therefore need to modify the config below accordingly).

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  .
  .
  .
  <PropertyGroup>
    <TestResultsFolderPath>bin$(Configuration)TestResults</TestResultsFolderPath>
  </PropertyGroup>
  <Target Name="AfterClean">
    <RemoveDir Directories="$(TestResultsFolderPath)" Condition="Exists('$(TestResultsFolderPath)')" />
  </Target>
</Project>

This target will check if there is a test results folder, and if there is, it will delete it (and it will only run when you clean the solution/project).

If you have more than one test project (i.e. one for unit tests and one for integration tests, etc.) you need to add it the project file for each project. Also beware that adding this target will affect everyone working on the project, not just you!

This solution should work for other test runners as well, just modify the “TestResultsFolderPathabove to reflect where the test results are created.

As I said in the beginning, some test runners allow you to configure how many old test results should be kept at any time, making this a non-issue. E.g. if you’re using the test runner found in Visual Studio out of the box, you could go to “Tools –> Options –> Test Tools –> Test Execution” and specify a number for the “Limit number of old Test Results to”-setting.