2013-04-11 46 views
0

我米使用sharpsvn庫,我想做一個開關,但它不斷給我下面的錯誤:的.Switch命令sharpSvn不是一個有效的路徑C#

"This argument is not a valid path. A Uri was specified."

我檢查,如果路徑是OKE路徑是好的任何想法什麼是錯的?

var configpath2 = "http://website.com/svn/CMS/trunk/Configuration"; 

teststring = localpath + @"\trunk\Configuration\CMS"; 
svnClient.Switch(new Uri(teststring).ToString(), new SvnUriTarget(new Uri(configpath2))); 
+0

'localpath'包含什麼?在'teststring'或'configpath2'上引發異常的地方? – Shaharyar 2013-04-11 13:25:45

+0

localpath是中繼線所在的本地文件夾。 它在函數結束時拋出。 – Trustos 2013-04-11 13:32:27

+0

結束哪些功能?顯示該函數的最後一條語句 – Shaharyar 2013-04-11 13:38:16

回答

2

一些相關鏈接:

  1. http://docs.sharpsvn.net/current/html/M_SharpSvn_SvnClient_Switch_1.htm
  2. http://docs.sharpsvn.net/current/html/Overload_SharpSvn_SvnClient_Switch.htm

我的理解通過閱讀上面提到的網頁,是你必須通過string作爲第一個參數Switch。試試這個:

svnClient.Switch(teststring, new SvnUriTarget(new Uri(configpath2))); 
+0

我試過了,它沒有工作,它保持相同的信息。一個可行的例子會很好,但不能在網上找到。 – Trustos 2013-04-11 14:01:30

+1

@Trustos也許看看[SwitchTests](http://sharpsvn.open.collab.net/svn/sharpsvn/trunk/src/SharpSvn.Tests/Commands/SwitchTests.cs)中的一些工作示例(用戶名guest ,沒有密碼)。開關需要兩個參數,第一個是應該切換的工作副本的路徑。第二個是要切換到的新位置的Uri。因此,不僅第一個參數應該是'System.String'類型,它應該是您計算機上的有效路徑。 – 2013-05-14 18:07:43

相關問題