Build Version vs Revision number

风流意气都作罢 提交于 2019-12-05 04:22:56

When I build, I put that build number everywhere.

  • I put it in a tag in svn.
  • I put it in the Assembly metadata of every assembly I build.
  • I append it to the end of the filename in my installers.
  • I put it in the footer of each of my deployed webpages.
  • I put it in the footer of my reports.
  • I put it in the splash screen of my client side apps.
  • I put it in the welcome screen for my installers.

The only thing I don't put it in is my coffee, which I take black.

All of this lets a maintainer know at a glance exactly where the code came from for what they're seeing, whether they're viewing a webpage, or looking at the properties of one of the built assemblies in Explorer, or whatever.

Tags aren't really useful if you happen to build often. Maybe find a way to update Assembly version based on the svn revision instead? Also include the branch name, because they share the revisions.

And you should be able to extract the assembly version in your ASP.NET pages and print it programmatically in a footer or something.

You could tag the Subversion trunk with the AssembleVersion or AssemblyFileVersion, whichever makes the most sense.

You could also keep track of the Subversion revision number the same way you currently keep track of the AssembleVersion and AssemblyFileVersion when you deploy.

Apply a tag to your source tree after you have updated the AssemblyVersion and AssemblyFileVersion.

You could "branch for release". Before creating a release build you could branch the trunk and then create a tag on the new branch with the release version number.

              + release tag
             /
            +--------------------- release branch
           /  
----------+----------------------------------------------------- trunk

This would allow you to keep track of all individual releases in SVN. It would also allow you to make isolated bug fixes on release branches that could be released as patches. The bug fix could then be merged back into the trunk.

              +                 + patch release tag
             /                 /
            +-----------------+-+---- release branch
           /                    | merged fix into trunk...
----------+----------------------------------------------------- trunk

Tags/branches are definately the recommended approach here.

You can also (or additionally) include the svn revision number in your AssemblyInfo. One approach is to use the AssemblyInfo task from the msbuildtasks project at http://msbuildtasks.tigris.org

For more info, google msbuild svn revision assemblyinfo

You could then do without tags/branches, as you can always check out a specific revision, and/or create a branch from a specific revision.

Another option is to use last changed revision as your build number. This means each time you build you auto-tag. It's easy with hudson/jenkins since you have an environment variable SVN_REVISION. The problem is that revision number get very large and hallway discussions about 1.0.0.20456 vs 1.0.0.20489 are a mouthful.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!