开发者

Use current date/time to set FileVersionInfo and set label with CruiseControl.NET

I've been looking into the following:

  1. With an existing开发者_如何学Python AssemblyInfo.cs file change the AssemblyFileVersion to the current date and time,i.e. YYMM.DD.HH.MM
  2. Take the date and time used in (1) and label the sourcecode with it (in SourceSafe)

I've managed to get MSBuild file and CC to integrate but I need to pass out of the MSBUILD file a variable that I can then pass to a CC task to label sourcesafe if the build completes.

Any ideas?


One Idea would be to have your MSBuild create an environment variable with what it labled with, then it would be available in all subsequent tasks for this project. However I am wondering why you would use date time in this format, since both spots for all intents and purposes already would have the date. Why not use a meaningful label like build number, then have MSBuild grab the labeler format from the state file and use that to update the Assembly infos. Then your labeler would just use that anyways. No need to retain and transfer. The reason I say time/date is irrelevant is that the normal process will all ready tell you that date/time the label and exe were created. Why do it twice?


In my experience, it's CCNet that is typically generating the build number (in your case, based off the current date and time). You will want to use the Date Labeller in your ccnet.config file.

There is an AssemblyInfo task in the the MSBuild Community Tasks Project. You specify the target AssemblyInfo.cs file and what values to assign to which attributes.

The build label generated by CCNet is passed to MSBuild via the $(CCNetLabel) variable. This is done automatically when CCNet calls MSBuild, so you can just start using $(CCNetLabel) in your MSBuild file. That takes care of #1 above.

For #2 you'll want to add this in your SourceControl block of your ccnet.config file:

<applyLabel>True</applyLabel>

This will cause the version to be applied as a label in Visual SourceSafe if your build succeeds.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜