2008-10-06 57 views
2

我們已將TFS 2008設置爲檢出項目中的所有AssemblyInfo.cs文件,使用AssemblyInfoTask更新它們,然後根據以下內容撤消簽出或簽入構建是否通過。不幸的是,當兩個構建排隊在一起時,這會導致部分完成的構建,因爲AssemblyInfo.cs文件似乎在先前版本中檢出到前一次檢入。AssemblyInfo.cs文件的自動更新和檢入偶爾會導致部分失敗

爲了解決這個問題,我認爲我可以使用「獲取」任務來強制AssemblyInfo.cs文件更新它們之前的最新版本,但這似乎沒有效果。有任何想法嗎?

<Target Name="AfterGet" Condition="'$(IsDesktopBuild)'!='true'"> 
<Message Text="SolutionRoot = $(SolutionRoot)" /> 
<Message Text="OutDir = $(OutDir)" /> 
<!-- Set the AssemblyInfoFiles items dynamically --> 
<CreateItem Include="$(SolutionRoot)\Main\Source\InputApplicationSln\**\$(AssemblyInfoSpec)"> 
    <Output ItemName="AssemblyInfoFiles" TaskParameter="Include" /> 
</CreateItem> 

<Message Text="$(AssemblyInfoFiles)" /> 

<!-- When builds are queued up successively, it is possible for the next build to be set up before the AssemblyInfoSpec is checked in so we need to force 
    the latest these versions of these files to be got before a checkout --> 
<Get Condition=" '$(SkipGet)'!='true' " TeamFoundationServerUrl="$(TeamFoundationServerUrl)" Workspace="$(WorkspaceName)" Filespec="$(AssemblyInfoSpec)" Recursive="$(RecursiveGet)" Force="$(ForceGet)" /> 

<Exec WorkingDirectory="$(SolutionRoot)\Main\Source\InputApplicationSln" 
      Command="$(TF) checkout /recursive $(AssemblyInfoSpec)"/> 

回答

0

更改:

<Get Condition=" '$(SkipGet)'!='true' " TeamFoundationServerUrl="$(TeamFoundationServerUrl)" Workspace="$(WorkspaceName)" Filespec="$(AssemblyInfoSpec)" Recursive="$(RecursiveGet)" Force="$(ForceGet)" /> 

要:

<Get Condition=" '$(SkipGet)'!='true' " TeamFoundationServerUrl="$(TeamFoundationServerUrl)" Workspace="$(WorkspaceName)" Filespec="$(AssemblyInfoSpec)" Recursive="True" Force="True" /> 

迫使AssemblyInfo.cs中的文件與樹的頂部被覆蓋。它到目前爲止工作,但更多的是一個黑客比優雅的東西。

0

請問您構建重新編寫的AssemblyInfo文件,然後檢查他們回來?或者你只是在本地修改AssemblyInfo文件。我個人比較喜歡後一種方法 - 如記錄了在TFSBuild recipies網站:

http://tfsbuild.com/AssemblyVersioning%20.ashx

我從來沒有真正坐下來檢查,但如果你在程序集信息文件選中,那麼可以在下面的是我想知道發生這可能會導致您的問題...

  1. 請求構建,目前變更= 42
  2. 構建1運行
  3. 請求構建變更42開始,當前的C hangeset = 42(仍然)
  4. 生成2變更42排隊
  5. 生成1個檢查在新集信息文件,當前變更= 43
  6. 生成1完成
  7. 生成2變更42周開始,DOWS的一個get changeset 42意味着AssemblyInfo文件是摺疊文件。

正如我所說的,並不完全確定何時爲構建確定更改集編號 - 排隊時或運行時。在排隊時,它會更有意義。

+0

你說得對,我們簽出,修改,然後,一旦構建成功,再次登入。這是爲了確保修改後的AssemblyInfo.cs與修改後的版本號相匹配,並幫助我們重建以前的版本。我假設第二個get命令不是要走的路? – 2008-10-07 09:11:19

相關問題