Code Coverage with VS2010 – Output Directory Problem

0 Flares Twitter 0 Facebook 0 StumbleUpon 0 Google+ 0 LinkedIn 0 0 Flares ×

I’ve been working with code coverage in vs2010 for the last year(ish), and have encountered numerous problems, some I can solve, some I can’t!!

One problem I had encoutered was in setting the testsettings file for code coverage. The problem was that visual studio seems to (by default) be storing absolute paths to code coverage file binary and pdb file. My initial solution was to manually edit the testsettings file, to be a more referential path (i.e. rather than ‘C:\project\etc\bin\debug\etc.dll’, make it ‘..\etc\bin\debug\etc.dll’).

This all worked fine, but it still meant I was hard coding to the debug directory – and therefore my release build output would not be accurate. To save the day I just found the following post by Rory Primrose: http://www.neovolve.com/post/2008/01/30/incorrect-code-coverage-references-in-testrunconfig.aspx

In short the answer is to user either %OutDir% or $(OutDir) in the testsettings file, so the links look more like ‘%OutDir%\etc.dll’.

Obvious really!!

Matt

, ,

The Essential App Marketing Kit
Subscribe To My Newsletter To Get an Entire Chapter From The Book for FREE
Never display this again
0 Flares Twitter 0 Facebook 0 StumbleUpon 0 Google+ 0 LinkedIn 0 0 Flares ×