Visual Studio integrated custom MSBuild task behaviour

倖福魔咒の 提交于 2019-12-05 06:19:00

问题


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/


回答1:


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




回答2:


I have no solution to your exact problem, but have some thoughts.

Are you sure you want to run a full suite of unit tests at the end of each and every build? I personally find it to be a productivity killer. Rather, while working with code I tend to run a small subset tests which cover only the code in question, and this is where tools like ReSharper or TestDriven.NET come into play.


(source: jetbrains.com)



来源:https://stackoverflow.com/questions/850563/visual-studio-integrated-custom-msbuild-task-behaviour

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!