0
我想使用PowerShell 2.0和SharpSVN 1.7從SVN執行svn checkout或更新?PowerShell SharpSvn證書問題?
當我在Powershell之外運行TortoiseSVN時 - 出現證書錯誤,必須單擊接受,然後連接。 在使用SharpSvn PowerShell中,我得到以下錯誤:
Exception calling "CheckOut" with "2" argument(s): "Unable to connect to a repository at URL '...'"
At Z:\Temp\SVNTEST\svntest.ps1:64 char:20
+ $svnClient.CheckOut <<<< ($repoUri, $svnLocalPath)
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : DotNetMethodException
是相當staightforward,有AR將其捕獲錯誤和成功的異常處理程序的一些C#示例代碼,我不知道這是否是我的問題還是如何在PowerShell中做到這一點
下面的代碼片段 - 任何幫助讚賞
[System.IO.Directory]::SetCurrentDirectory($currentScriptDirectory.Path)
$evidence = [System.Reflection.Assembly]::GetExecutingAssembly().Evidence
[Reflection.Assembly]::LoadFile(("...SharpSvn.dll"),$evidence)
$svnClient = new-object SharpSvn.SvnClient
$repoUri = new-object SharpSvn.SvnUriTarget($svnUrl)
$svnClient.Authentication.DefaultCredentials = New-Object System.Net.NetworkCredential($svnUsername,$svnPassword)
$svnClient.CheckOut($repoUri, $svnLocalPath)
添加上面的代碼行之後: $ svnClient.Authentication.DefaultCredentials =新對象System.Net.NetworkCredential($ svnUsername,$ svnPassword) – user160351