zoukankan      html  css  js  c++  java
  • 在VS项目中使用SVN版本号作为编译版本号

    1、复制版本号文件 AssemblyInfo.cs

    2、把复制后的文件改名为 AssemblyInfo.templet.cs
    修改内容: [assembly: AssemblyVersion("1.0.0.$WCREV$")]

    3、工程右键->属性->生成事件->预生成事件命令行 输入以下代码:
    "C:Program FilesTortoiseSVNinSubWCRev.exe" $(ProjectDir) $(ProjectDir)PropertiesAssemblyInfo.templet.cs $(ProjectDir)PropertiesAssemblyInfo.cs -f

    //-------------------------------------------------------------------------------------------------------------- 

    1,svn的工具可获取版本号并更新到项目文件

    如果提供了源文件和目的文件,SubWCRev 会复制源文件到目标文件,执行如下所属的关键字替换:

    表 5.2. 列出可用的命令行开关

    关键字描述
    $WCREV$ 工作副本中最高的提交版本来替换
    $WCDATE$ 用最高提交版本的日期/时间替换。默认使用国际化格式:yyyy-mm-dd hh:mm:ss。作为选择,你可以指定strftime()使用自定义格式,例如:$WCDATE=%a %b %d %I:%M:%S %p$。格式字符的列表参见在线引用
    $WCNOW$ Replaced with the current system date/time. This can be used to indicate the build time. Time formatting can be used as described for$WCDATE$.
    $WCRANGE$ 在工作目录用更新版本范围替换。如果工作目录处于一致的状态,它是一个单一版本。如果工作目录包含混合版本,或者是过时,或者是故意更新到版本,那么这个范围会用象100:200这样的格式来显示。
    $WCMIXED$ 当有混合版本时用TText替换$WCMIXED?TText:FText$,否则用FText替换。
    $WCMODS$ 若本地存在修改,就用TText替换$WCMODS?TText:FText$,否则用FText替换。
    $WCURL$ 用传递给SubWCRev的工作目录的版本库地址替换。
    $WCINSVN$ $WCINSVN?TText:FText$is replaced withTTextif the entry is versioned, orFTextif not.
    $WCNEEDSLOCK$ $WCNEEDSLOCK?TText:FText$is replaced withTTextif the entry has thesvn:needs-lockproperty set, orFTextif not.
    $WCISLOCKED$ $WCISLOCKED?TText:FText$is replaced withTTextif the entry is locked, orFTextif not.
    $WCLOCKDATE$ Replaced with the lock date. Time formatting can be used as described for$WCDATE$.
    $WCLOCKOWNER$ Replaced with the name of the lock owner.
    $WCLOCKCOMMENT$ Replaced with the comment of the lock.

    SubWCRev.exe从命令行或脚本中运行,使用命令行参数控制。

    SubWCRev WorkingCopyPath [SrcVersionFile DstVersionFile] [-nmdfe]

    WorkingCopyPath是要检查的工作副本路径,你可以只对工作副本使用SubWCRev,而不是直接对版本库,这个路径可以是绝对路径,也可以是工作目录的相对路径。

    如果你想让SubWCRev执行关键字替换,象版本库版本,地址等字段保存到文本文件,就需要提供一个模版文件SrcVersionFile,输出文件DstVersionFile就是模版替换之后的版本。

    有几个开关影响 SubWCRev工作。如果使用多个,必须用单个组指定,例如要用-nm,不能用-n -m

    表 5.1. 列出可用的命令行开关

    切换描述
    -n If this switch is given, SubWCRev will exit withERRORLEVEL 7if the working copy contains local modifications. This may be used to prevent building with uncommitted changes present.
    -m If this switch is given, SubWCRev will exit withERRORLEVEL 8if the working copy contains mixed revisions. This may be used to prevent building with a partially updated working copy.
    -d If this switch is given, SubWCRev will exit withERRORLEVEL 9if the destination file already exists.
    -f 如果给出这个开关,SubWCRev 就会包含文件夹的最后修改版本。默认行为是取得版本号时只考虑文件。
    -e If this switch is given, SubWCRev will examine directories which are included withsvn:externals, but only if they are from the same repository. The default behaviour is to ignore externals.
    -x If this switch is given, SubWCRev will output the revision numbers in HEX.
    -X If this switch is given, SubWCRev will output the revision numbers in HEX, with '0X' prepended.

    参考这个文档http://tortoisesvn.net/docs/nightly/TortoiseSVN_zh_CN/tsvn-subwcrev.html

  • 相关阅读:
    Javascript网页摇一摇
    移动端Web开发注意点
    Clappr——开源的Web视频播放器
    光看这图片就知道是大片--今天是五一劳动节尽管还是敲着代码(日常就是这样)然后想不出写什么了,也找不到好的素材,最后开心一下吧
    大放异彩的伪元素——可以做什么?(转)别人分享的文章,发现很不错,果断收藏了
    全屏滚动效果H5FullscreenPage.js
    今天我已无力吐槽了!写个没有营养的吐槽文。只是个人日记
    css的一些小技巧!页面视觉差!
    CSS3 transforms 3D翻开
    Javascript非构造函数的继承
  • 原文地址:https://www.cnblogs.com/zouhao/p/3446951.html
Copyright © 2011-2022 走看看