vb.net 预生成事件获取SVN版本号,编译日期,版本日期

前端之家收集整理的这篇文章主要介绍了vb.net 预生成事件获取SVN版本号,编译日期,版本日期前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

1、复制My Project文件夹下面的AssemblyInfo.vb文件,命名为ver.tmp.vb。

在这个文件中,你能找到如下两行代码

   <assembly: AssemblyVersion( "1.0.0.0" )> 
   <assembly: AssemblyFileVersion( "1.0.0.0" )>

其中的“1.0.0.0”就是程序的版本号,它使用的是“主版本号.次版本号.内部版本号.修订号”的形式。前三个改成你自己需要的数字,最后一个改成“$WCREV$”,改完之后应该是类 似下面的样子:

   <assembly: AssemblyVersion( "1.0.0.$WCREV$" )> 
   <assembly: AssemblyFileVersion( "1.0.0.$WCREV$" )>
<Assembly: AssemblyDescription("$WCDATE$-$WCNOW$")> ‘增加,变量代表值,可以在第四步看到

2、打开--项目--属性---编译--生成事件

3、加入命令SubWCRev.exe $(SolutionDir) "$(ProjectDir)My Project\ver.tmp.vb" "$(ProjectDir)My Project\AssemblyInfo.vb"

注:文件名含有空格,需要添加引号

4、可以在命令行中输入SubWCRev.exe,可以得到帮助

如下: C:\Documents and Settings\Administrator>SubWCRev.exe SubWCRev 1.6.5,Build 16974 - 32 Bit Usage: SubWCRev WorkingCopyPath [SrcVersionFile DstVersionFile] [-nmdf] Params: WorkingCopyPath : path to a Subversion working copy. SrcVersionFile : path to a template file containing keywords. DstVersionFile : path to save the resulting parsed file. -n : if given,then SubWCRev will error if the working copy contains local modifications. -m : if given,then SubWCRev will error if the working copy contains mixed revisions. -d : if given,then SubWCRev will only do its job if DstVersionFile does not exist. -f : if given,then SubWCRev will include the last-committed revision of folders. Default is to use only files to get the revision numbers. this only affects $WCREV$ and $WCDATE$. -e : if given,also include dirs which are included with svn:externals,but only if they're from the same repository. -x : if given,then SubWCRev will write the revisions numbers in HEX instead of decimal -X : if given,then SubWCRev will write the revisions numbers in HEX with '0x' before them Switches must be given in a single argument,e.g. '-nm' not '-n -m'. SubWCRev reads the Subversion status of all files in a working copy excluding externals. If SrcVersionFile is specified,it is scanned for special placeholders of the form "$WCxxx$". SrcVersionFile is then copied to DstVersionFile but the placeholders are replaced with information about the working copy as follows: $WCREV$ Highest committed revision number $WCDATE$ Date of highest committed revision $WCDATE=$ Like $WCDATE$ with an added strftime format after the = $WCRANGE$ Update revision range $WCURL$ Repository URL of the working copy $WCNOW$ Current system date & time $WCNOW=$ Like $WCNOW$ with an added strftime format after the = $WCLOCKDATE$ Lock date for this item $WCLOCKDATE=$ Like $WCLOCKDATE$ with an added strftime format after the = $WCLOCKOWNER$ Lock owner for this item $WCLOCKCOMMENT$ Lock comment for this item The strftime format strings for $WCxxx=$ must not be longer than 1024 characters,and must not produce output greater than 1024 characters. Placeholders of the form "$WCxxx?TrueText:FalseText$" are replaced with TrueText if the tested condition is true,and FalseText if false. $WCMODS$ True if local modifications found $WCMIXED$ True if mixed update revisions found $WCINSVN$ True if the item is versioned $WCNEEDSLOCK$ True if the svn:needs-lock property is set $WCISLOCKED$ True if the item is locked

原文链接:https://www.f2er.com/vb/259476.html

猜你在找的VB相关文章