mercredi 19 avril 2017

VsTest doesnt run with arguments generated by powershell

I have written a simple powershell script to generate all the list of test DLLs, using some help in stackover and other places.

{

cd "C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow"
$sourceDirectory = "D:\workspace\SolutionDir"
$files = get-childitem $sourceDirectory -recurse -include "*.Test*.dll" | select -expand FullName | where {$_ -like "*.Test*.dll"}
foreach ($file in $files)
{
    $cFiles = $cFiles + $file.trim() + " "
}
$cFiles = $cFiles -replace ".{}$" #drop last 1 chars

echo $cFiles

$argumentList = @("$cFiles", "/framework:framework45", "/platform:x64")

vstest.console.exe $argumentList

} But I get an error Error: The test source file "D:\workspace\SolutionDir\Proj1.Test\bin\x64\Release\Proj1.Test.dll D:\workspace\SolutionDir\Proj2.Test\bin\x64\Release\Proj2.Test.dll D:\workspace\SolutionDir\Proj3.Test\bin\x64\Release\Proj3.Test.dll" was not found

When I echo the argument list, delete the spaces and type them manually and copy the command back into powershell, it works. I am suspecting that this has something to do with the encoding of the strings. But I am not able to figure out how to change it or otherwise make it work.

Any help is much appreciated.

Aucun commentaire:

Enregistrer un commentaire