4

I'm trying run a build args against open cover but I can't find the file location since there are spaces in the location itself

  <executable>C:\Program Files (x86)\OpenCover\OpenCover.Console.exe</executable>
  <buildArgs>-register:user -target:"C:\Program Files (x86)\NUnit 2.6.2\bin\nunit-console.exe" -targetargs:"C:\Users\username\Documents\Visual Studio 2010\Projects\WebCrawlerMVC\WebCrawlerMVC.Tests\bin\Debug\WebCrawlerMVC.Tests.dll" /noshadow /xml=reports\TestResult.xml" - filter:"+[WebCrawlerMVC.Tests*]*  -output:"C:\Program Files (x86)\CruiseControl.NET\server\reports\coverage.xml" </buildArgs>
  </exec>
  <exec>
    <executable>C:\Program Files (x86)\ReportGenerator\bin\ReportGenerator.exe</executable>
    <buildArgs>-reports:reports\coverage.xml</buildArgs>

the error comes out as File type not known: C:Users\username\Documents\Visual when i run it through the OpenCover console

so it's not being able to view the whole file path, is there a way around this? I realize my whole argument will have some errors still, but I can't get to fixing them until I resolve this one.

Update:

  targetargs:"\"C:\Users\lardern\Documents\Visual Studio 2010\Projects\WebCrawlerMVC\WebCrawlerMVC.Tests\bin\Debug\WebCrawlerMVC.Tests.dll"

the "\ "C: seems to allow the spacing to go through, I still have errors with my code, but its no longer a file path issue.

Update2:

  <task>
  <exec>
  <executable>C:\Program Files (x86)\OpenCover\OpenCover.Console.exe</executable>
  <buildargs>-target:"C:\Program Files (x86)\NUnit 2.6.2\bin\nunit-console.exe" -register:user -targetargs:"/nologo /noshadow \"C:\Users\username\Documents\Visual Studio 2010\Projects\WebCrawlerMVC\WebCrawlerMVC.Tests\bin\Debug\WebCrawlerMVC.Tests.dll" -filter:+[WebCrawlerMVC]* -output:coverage.xml </buildargs>
  </exec>
  </tasks>

this is this is the working version.

Lewis
  • 2,373
  • 2
  • 22
  • 30

2 Answers2

5

try escaping the quotes wrapping the path to the assembly

<buildArgs>-register:user -target:"C:\Program Files (x86)\NUnit 2.6.2\bin\nunit-console.exe" 
"-targetargs:\"C:\Users\username\Documents\Visual Studio 2010\Projects\WebCrawlerMVC\WebCrawlerMVC.Tests\bin\Debug\WebCrawlerMVC.Tests.dll\" /noshadow /xml=reports\TestResult.xml" - filter:"+[WebCrawlerMVC.Tests*]*"  -output:"C:\Program Files (x86)\CruiseControl.NET\server\reports\coverage.xml" </buildArgs>
Shaun Wilde
  • 8,228
  • 4
  • 36
  • 56
  • 1
    I copied and pasted but it gave me the same error but i entered http://pastebin.com/ZbmjCvbc it runs the tests but then comes back with no assemblies that matched the supplier could due missing pdb in the webcrawler.dll says it's missing the pdb but it's actually located in the same folder, is the filter wrong? – Lewis Jan 17 '13 at 13:05
  • 1
    In your paste you had the first escape but missed the other `Debug\WebCrawlerMVC.Tests.dll\" /noshadow` – Shaun Wilde Jan 18 '13 at 11:27
2

Maybe this link will provide a bit of help.

The environment variables are expanded before being passed to opencover and it looks like you have spaces in your path name. The Usage Wiki describes that arguments with spaces in them have to be escaped with \". I recommend you create a new variable with escaped paths for use with OpenCover.

Just a thought.

Adam K Dean
  • 7,387
  • 10
  • 47
  • 68