Integrated custom MSBuild task behavior in Visual Studio
I was browsing the net for a custom NUnit MSBuild task that ran on every build and also played well with Visual Studio UI (2008 is my version). I found the MSBuild.Community.Tasks project, which was great but failed in the Visual Studio integration part. What I actually wanted was to get the failed tests displayed as warnings / errors in the VS error list box (as well as building the project FAILED when the tests failed). So I wrote my own MSBuild task that does the job exactly the way I wanted it.
BUT.
The only problem I've run into is that the usual behavior of VS UI error lists is that when you click on an error, it jumps to the corresponding source file and highlights the problematic code. I was able to associate the file and line number with the failed test, however I was unable to convince Visual Studio in any way of the problematic code for HIGHLIGHT (when I double-clicked the error). All I get is the cursor in the right place. I tried all sorts of combinations of parameters line
, endLine
, column
, endColumn
( Log.LogError()
), but to no avail. And based on the error caused by compiler errors, it looks like it also only provides row and column (no trailing values).
Someone ran against this weirdness and solved it?
Update May 13, 2009
You can get this project for free (no method selection) at
http://code.google.com/p/nunitmsbuildvsintegrated/
a source to share
I don't have a solution to your specific problem, but I have some thoughts.
Are you sure you want to run a full suite of unit tests at the end of each build? I personally think this is a performance killer. Rather, when working with code, I tend to run small subset tests that only cover the code in question, and this is where tools like ReSharper or TestDriven.NET are used .
a source to share