2013-08-13 4 views
4

나는 Chocolatey를 사용하여 psake를 설치했다. 이렇게하면 powershell 또는 windows 명령 행에서 psake 명령을 사용하여 psake를 실행할 수 있습니다.psake의 초콜릿 버전에 속성을 전달하는 방법

그러나 나는 시도하고 다음 명령

psake TestProperties -properties @{"tags"="test"} 

나는 다음과 같은 오류 얻을 사용 psake하는 속성을 전달할 때이를 극복하는 방법에

PS D:\projects\WebTestAutomation> psake TestProperties -properties @{"tags"="test"} 
"& 'C:\Chocolatey\lib\psake.4.2.0.1\tools\\psake.ps1' TestProperties -properties System.Collections.Hashtable 
C:\Chocolatey\lib\psake.4.2.0.1\tools\psake.ps1 : Cannot process argument transformation on parameter 'properties'. Cannot convert the "System.Collections.Hashtable" value of 
type "System.String" to type "System.Collections.Hashtable". 
At line:1 char:80 
+ & 'C:\Chocolatey\lib\psake.4.2.0.1\tools\\psake.ps1' TestProperties -properties <<<< System.Collections.Hashtable; if ($psake.build_success -eq $false) { exit 1 } else { e 
xit 0 } 
    + CategoryInfo   : InvalidData: (:) [psake.ps1], ParameterBindin...mationException 
    + FullyQualifiedErrorId : ParameterArgumentTransformationError,psake.ps1 

어떤 아이디어?

답변

5

Hashtablestring으로 전달하여이를 해결했습니다.

psake TestProperties -properties "@{tags='test'}" 

또한 명령 프롬프트에서 powershell 명령을 실행하는 것이 좋습니다. psake 명령은 .bat 파일을 호출하여 작동하므로 .ps1 파일을 실행하는 .cmd을 호출하고 속성에서 앰퍼샌드를 사용하면 명령이 powershell에서 실행될 때 문제가 발생합니다. PowerShell을 콘솔에서 실행하면

예를 들어, 다음 명령은 성공적으로 명령 프롬프트하지만 오류를 실행합니다

psake TestProperties -properties "@{tags='test^&wip'}" 

참고 ^의 사용이 & 문자를 탈출.