.nethudsonpartcover

How do you run PartCover with spaces in the path?


I have a msbuild file that I'm trying to run from Hudson CI. It outputs like this

"C:\Program Files\Gubka Bob\PartCover .NET 2\PartCover.exe" --target "C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\MSTest.exe" --target-args "/noisolation" "/testcontainer:C:\CI\Hudson\jobs\Video Raffle\workspace\Source\VideoRaffleCaller\Source\VideoRaffleCaller.Test.Unit\bin\Debug\VideoRaffleCaller.Test.Unit.dll" --include "[VideoRaffleCaller*]*" --output "Coverage\partcover.xml"

I get this error

Invalid switch "raffle\workspace\source\videorafflecaller\source\videorafflecall er.test.unit\bin\debug\videorafflecaller.test.unit.dll". For switch syntax, type "MSTest /help"

WTF? Looks like PartCover doesn't handle spaces in the --target-args well. Or am I missing some quotes somewhere? Has anyone gotten something like to to work?


Solution

  • You are completely right that you forgot to quote the path. Read the guide on how to integrate PartCover with MSBuild.

    --target-args=
    Argument specifies arguments for target process. If target argument 
    contains spaces - quote . If you want specify quote (") in , then 
    precede it by slash (\)
    

    So try to change your testcontainer parameter to

    "/testcontainer:\"C:\CI\Hudson\jobs\Video Raffle\workspace\Source\VideoRaffleCaller\Source\VideoRaffleCaller.Test.Unit\bin\Debug\VideoRaffleCaller.Test.Unit.dll\""