English 中文(简体)
需要帮助在使用TFSBuild的合成物中保持建筑数量和组件
原标题:Need help on keeping build numbers and assemblies in sync using TFSBuild
最佳回答

Stuart Preston explains a simple way to set the assembly info on his blog: http://stuartpreston.net/blog/2010/05/02/simple-assembly-versioning-with-team-build-2010/

<><>Edit>:

最重要的环节是死亡,这里是:

2010年5月2日由Stuart Preston在小组服务器下调任

There are many more sophisticated ways of achieving this but none seemed to give me exactly what I wanted, so here I present yet another way of doing assembly versioning with Team Build 2010. I wanted my Team Build number to exactly match that of my assembly versions (and not be derived), like this:

(单位:百万)

因此,我是如何这样做的。 从我开始,在我的建筑定义范围内定制建筑房格式:

(单位:百万)

就我而言,我决定根据具体情况具体化,以便明确增加“0.1”的主要和次要数字。 这让我控制我想要达到的版本的前两个部分。 我在前面还加上了<代码>(Month)$(DayOfMonth)和。 在2010年5月2日,这将产生10502。 (我不使用整整整一年的原因是,今天,它将产生100502个建筑群,档案版本的编号不能高于65335个。)

When I decide to work on version 0.2, 0.3 or 1.0 all I have to do is increment the Build Number here and save the definition, I’m also happy to increment the number when the year changes. I said it was simple!

建筑编号格式的最后部分作为依据(即修订编号,每加1,在当天和第二天的树脂的基础上再加1)。

现在,我们需要做的是,在以下情况下检索这一版本:MSBuild。 房地产总账.cs文档(需要评论) AssemblyFileVersion line in that file first andeck it in.

在这里,你需要将文件打入.csproj文档中的碎块(你不得不在说明台或你的赞成文本编辑上核对)。

<UsingTask
    TaskName="Microsoft.TeamFoundation.Build.Tasks.GetBuildProperties"
    AssemblyFile="$(MSBuildProgramFiles32)Microsoft Visual Studio 10.0Common7IDEPrivateAssembliesMicrosoft.TeamFoundation.Build.ProcessComponents.dll"
  Condition="  $(BuildUri)  !=    "/>

<Target Name="BeforeBuild" Condition="  $(BuildUri)  !=    ">
  <GetBuildProperties TeamFoundationServerUrl="$(TeamFoundationServerUrl)" BuildUri="$(BuildUri)">
    <Output TaskParameter="BuildNumber" PropertyName="BuildNumber" />
  </GetBuildProperties>

  <PropertyGroup>
    <BuildNumberSplitLocation>$([MSBuild]::Add($(BuildNumber.LastIndexOf( _ )),1))</BuildNumberSplitLocation>
  </PropertyGroup>

  <ItemGroup>
    <AssemblyVersionLines Include="[assembly:AssemblyFileVersion(&quot;$(BuildNumber.Substring($(BuildNumberSplitLocation)))&quot;)]" />
  </ItemGroup>

  <Exec Command="attrib -r &quot;$(ProjectDir)PropertiesAssemblyInfo.cs&quot;" ContinueOnError="false" />
  <Message Text="Lines being added: @(AssemblyVersionLines)" Importance="high" />
  <WriteLinesToFile File="$(ProjectDir)PropertiesAssemblyInfo.cs" Lines="@(AssemblyVersionLines)" />
</Target>

<>(参考文件

他修改了<代码>csproj文档,以更新<代码>。 AssemblyInfo.cs file before building with Value adopted in TF, so that the Assembly is editioned by a permutation of MMDD Rev

你的情况大不相同,因为与习俗一样,你的情况也大不相同。 为此,您可修改<代码>BuildNumberFormat,改为3.8.0.$(Rev:r)。 由于修订是唯一的改动,TF/code>将自动地为您增减。

如果你想更新<代码>3.8.0.部分,你可以再次人工编辑“建筑号码格式”。 否则,你需要一种储存和复制的解决办法;将建筑数量作为<条码>的一部分加以细分。

问题回答

暂无回答




相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...