私は、単純なpowershellスクリプトを書いて、テストのDLLのすべてのリストを生成しました。私はスペースを削除し、それらを手動で入力するとバックのPowerShellにコマンドをコピーして、引数リストをエコーするとVsTestはpowershellによって生成された引数で実行されません
{
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
}
は、しかし、私はエラー
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
を取得し、それが動作します。私はこれが文字列のエンコーディングと関係があることを疑う。しかし、私はそれを変更する方法やそれ以外の方法を理解することはできません。
ご迷惑をおかけして申し訳ありません。
を試してみてもらう-ChildItemコマンドレット
の結果を解析するべきではありませんあなた自身の質問に答える方法を教えてください。 https://blogs.technet.microsoft.com/heyscriptingguy/2011/09/20/solve-problems-with-external-command-lines-in-powershell/ –