The following is just a small idea of mine. In medium and large projects, we are all used to using command line to compile our system, for example, Nant compile . net Program , however, if I want to build once, add 1 . net self-contained addition, so you can use powershell to define a version-controlled small script program, Code :
$ Ver = "Ver. cs"
$ S = [System. Io. File]: readalllines ( $ Ver )
If ( $ S . Length -EQ 2 ){
$ Num = $ S [1]. Remove (0, 28). Remove (7, 3). Split ('.')
$ Sum = $ Num [0] + $ Num [1] + $ Num [2] + $ Num [3]
$ Result = $ Sum - [Int32]
$ R = $ Result + 1
$ Results = $ R . Tostring ();
Write-host current version: $ Results
$ Build = "[Assembly: assemblyversion ("""
+ $ Results [0] + "."
+ $ Results [1] + "."
+ $ Results [2] + "."
+ $ Results [3] + ")]"
$ S = "Using system. reflection ;" , $ Build
[System. Io. File]: writealllines ( $ Ver , $ S )
}
Where,Ver. CSIsC #File, which only contains version control code:
using system. reflection;
[Assembly: assemblyversion ( " 1.0.0.0 " )]
Then, in yourBuildIn batch processing, You can execute this script,Ver. CSIn1.0.0.0Add automatically1Become1.0.0.1Of course, the script can be changed at will, so that you can define that the version you want will automatically grow.
If you have your own version control method, share it. This is just my own idea. I think it is definitely not the best.......