views:

259

answers:

2

I'm trying to use the MSBuild NUnit community task to force tests to run on each build, but I now see that when I use ReSharper's test runner and it builds the project I'm running the tests twice. It works but is not really desirable.

Does anyone know of a variable or condition I can check within MSBuild so that I can skip the community task if I know the test runner is going to execute the tests anyway?

Note: I'm using VS2008 and the MSBuild script is integrated with the solution/project files. I want the best of all worlds. CTRL + SHIFT + B, plus command-line, plus CI server.

+2  A: 

I asked this question on the Resharper community forums and although I didn't get a direct yes or no to my question, I interpreted the answer to be no. If anyone wants to chime in with a confirmed yes or no, it would set my mind at ease.

I decided I could work around my problem by creating a solution configuration called DebugResharperTest and I choose that config when I want to use the Resharper test runner. That configuration name variable will keep the build from kicking off the NUnit msbuild task.

Aaron Wagner
+1  A: 

When building in Visual Studio MSBuild defines an extra property that you can use to disable the nUnit Task.

<NUnit Condition="'$(BuildingInsideVisualStudio)' != 'true'"
    ...other props 
    />
Paul Alexander
I hadn't seen that extra property. Thanks. Too bad resharper doesn't have a way to turn that property to false when it starts a build.
Aaron Wagner