2008-10-06 46 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

相关问题