2012-04-13 31 views
2

我需要移動包含TFS構建的文件共享,因此我編寫了一些代碼來遍歷構建集合並更新它們的放置位置。我知道代碼做東西,因爲當我在第二次運行時調試代碼時,droplocation現在顯示新的unc路徑。但是,當我進入團隊資源管理器並單擊「放置位置」進行構建時,我將被帶到舊的位置。重新定位已刪除的TFS構建

我錯過了什麼?

var buildServer = tpc.GetService<IBuildServer>(); 
         foreach (var build in buildServer.QueryBuilds(projectName)) 
         { 
          string newDropLocation = FixPath(build.DropLocation); 
          string newLogLocation = FixPath(build.LogLocation); 

          build.DropLocation = newDropLocation; 
          if(!String.IsNullOrEmpty(newLogLocation)) 
          { 
           build.LogLocation = newLogLocation; 
          } 
          build.Save(); 

          Console.WriteLine("------------"); 
          Console.WriteLine(newDropLocation); 
          Console.WriteLine(newDropLocationRoot); 
          Console.WriteLine(newLogLocation); 
         } 
+0

FWIW,FixPath只是一個幫助程序方法,它爲\\ olderserver \ share \和\\ newserver \ share \ share \ – 2012-04-13 19:04:48

+0

執行一個字符串替換。您是否更新新的放置位置根目錄? – 2012-04-13 19:15:30

+0

IBuildDetail.DropLocationRoot是隻讀的。 DropLocation和LogLocation具有setter。 – 2012-04-13 19:17:00

回答