views:

471

answers:

2

I was looking around the net for a NUnit custom MSBuild task that would run on every build and also nicely play with Visual Studio UI (2008 is my version). I found MSBuild.Community.Tasks project that was great, but failed in Visual Studio integration part. What I actually wanted to have is get failed tests displayed as warnings/errors in VS's error list window (and also FAILED project build when tests are not successful). So I wrote my own custom MSBuild task that does the job exactly how I wanted it to be.

BUT.

The only problem that I have is that normal VS UI error list behaviour is that when you click on an error it jumps to appropriate source file and highlights the problematic code. I was able to relate file and line number with failed test however I wasn't able in any way to persuade Visual Studio to HIGHLIGHT problematic code for me (when I double click the error). All I get is cursor in the right spot. I tried all kinds of combinations of line, endLine, column, endColumn method parameters (Log.LogError()), but to no avail. And based on error output by compiler errors it looks like it also provides just line and column (no end values).

Anybody ran against this oddity and solved it?

Update 13 May 2009
You can get this project for free (without method selection) at
http://code.google.com/p/nunitmsbuildvsintegrated/

A: 
Anton Gogolev
It depends on the project. If it's a huge project (probably needs refactoring) it will execute a bit longer, but it will still run a lot faster than in Nunit GUI (that gets run when you use TestDriven.net for example). The main reason is that developers tend to forget running tests before checking code in. On the other hand none of the tools you mentioned are free and especially ReSharper is a IDE speed killer (resource hungry).
Robert Koritnik
+1  A: 

For this feature, you must create Visual Studio Integrated Package that display custom panel in Visual Studio. This custom panel will be called when your project is built.

Visual Studio Extensibility Developer Center

Soul_Master
Any particular link or code that would point me in the right direction?
Robert Koritnik
Please download Visual Studio 2008 SDK 1.1 on Microsoft site. There are a lot of example for help you to create Visual Studio Integrated Package.
Soul_Master