2010-09-22 70 views
3

我們想生成以下格式構建說明:如何在TFS中填充Change.MergeSources字段?

1) Associated ChangeSets: 
2) - ChangeSet 45241, by Joe: "Patching fix for foobar" 
3)  'Foo.cs' integrated from dev v. 22 to qa v. 7 
4)  'Bar.cs' integrated from dev v. 9 to qa v. 3 

到目前爲止,我們有一個自定義生成步驟即完成1)和2)。它查看'AssociatedChangesetsAndWorkItems'TFS構建活動生成的信息。這裏是代碼:

protected override bool Execute(CodeActivityContext context) 
{ 
    StreamWriter sw = new StreamWriter(Path.Combine(BuildNotesPath.Get(context),"build-notes.txt")); 
    sw.WriteLine("Associated ChangSets:"); 
    foreach (Changeset changeset in BuildAssociatedChangesets.Get(context)) 
    { 
     sw.WriteLine(string.Format("ChangeSet {0}, by {1}: {2}", changeset.ChangesetId, changeset.Committer, changeset.Comment));    
     foreach (Change change in changeset.Changes) 
     {    
      foreach (MergeSource source in change.MergeSources) 
       sw.WriteLine(string.Format("\'t{0}': integrated from dev v. {1} to qa v. {2}", source.ServerItem, source.VersionFrom, source.VersionTo)); 
     } 
    } 
    sw.Flush(); 
    sw.Dispose(); 
    return true; 
} 

我們遇到的問題是'MergeSources'字段始終是一個空列表。我們需要做些什麼才能讓這個領域充滿?

回答