質問

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.

役に立ちましたか?

解決

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>

他のヒント

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.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top