2

我们将 TFS 2008 构建设置为签出项目中的所有 AssemblyInfo.cs 文件,使用 AssemblyInfoTask 更新它们,然后根据构建是否通过来撤消签出或签入。不幸的是,当两个构建紧密排列在一起时,这会导致构建部分完成,因为 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)"/>

4

2 回答 2

0

您的构建是否重写了 AssemblyInfo 文件,然后重新签入?还是您只是在本地修改 AssemblyInfo 文件。就我个人而言,我更喜欢后一种方法——正如 TFSBuild 食谱网站上所记录的那样:

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

我从来没有真正坐下来检查过,但我想知道如果您检查了 AssemblyInfo 文件,那么可能会发生以下情况,这可能会导致您的问题......

  1. 请求构建,当前变更集 = 42
  2. 变更集 42 的构建 1 开始运行
  3. 请求构建,当前变更集 = 42(仍然)
  4. 为变更集 42 排队的构建 2
  5. Build 1 检查新的 assemblyinfo 文件,当前变更集 = 43
  6. 构建 1 完成
  7. 变更集 42 的构建 2 开始,获取变更集 42 意味着 AssemblyInfo 文件是折叠文件。

正如我所说,不确定何时为构建确定变更集编号 - 在排队时或在运行时。不过,在排队的时候会更有意义。

于 2008-10-06T18:14:57.600 回答
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 文件。到目前为止,它一直在工作,但更像是一种 hack,而不是优雅的东西。

于 2008-10-08T07:14:12.833 回答