VC automatic Generation software version number
Flyfish
Objective:
The version of the software has a major version number. The child version number. Revision number. Compile Version number
Where the compiled version number is automatically synchronized with the SVN server version number (Revision).
Environment
You need to install TORTOISESVN on this machine
The first step
Search for Vs_version_info Versioninfo in the project's. rc file
Follow the example below to change
#ifdef _auto_increment_version fileversion2,0,4, $WCREV $ productversion2,0,4, $WCREV $ #else fileversion2,0,4,1 productversion2,0,4,1#endif #ifdef _auto_increment_version VALUE "FileVersion", "2.0.4. $WCREV $ " value" ProductVersion "," 2, 0, 4, $WCREV $ "#else value" FileVersion "," 2.0.4.1 " value" ProductVersion "," 2, 0, 4, 1 "#endif
If you do not write the conditional compilation command #ifdef, #else, #endif change 2,0,4 directly, $WCREV $. The resource view of the VC could not be resolved $WCREV $.
Undefined keyword or key name: $WCREV $
Step Two
VC Environment Settings Project Properties-build event-Pre-build event command line
Copy the following two lines
C:\ProgramFiles\TortoiseSVN\bin\subwcrev.exe $ (SolutionDir) $ (ProjectDir) $ (ProjectName). RC $ (ProjectDir) $ ( ProjectName). rc_rc.exe/fo$ (ProjectDir) $ (IntDir) $ (ProjectName). res/d _auto_increment_version/d _afxdll$ ( ProjectName). rc_
C:\ProgramFiles\TortoiseSVN\bin\subwcrev.exe Change your own TortoiseSVN installation path
Tool 1:subwcrev.exe
SubWCRev.exe is TortoiseSVN's own tool, through the SubWCRev.exe command line tool in the Tortoisesvn\bin directory
Read the revision fixed version number of the server
Perform keyword substitution in the template to modify the synchronization local version number.
Command-line arguments
Subwcrev Workingcopypath [Srcversionfiledstversionfile] [-nmdfe]
Tool 2:rc.exe
Rc.exe is a resource compiler resourcecompiler that comes with VC.
Command-line arguments
RC [Options] Script-file
Options is the compile option, Script-file is the compiled script file
FO Create res file name
D Define a symbol for the preprocessor (preprocessor)
_afxdll means using MFC in a shared DLL
Macro Description
The directory of the $ (SolutionDir) solution (defined as drive + path), including the trailing backslash "\".
The directory of the $ (ProjectDir) project (defined as drive + path), including the trailing backslash "\".
The base name of the $ (ProjectName) project.
$ (IntDir) The directory path relative to the project directory specified for the intermediate file. it resolves to the value of the "Intermediate Directory" property.
Reference links
Using RC (the RC Command line)
Macros that generate commands and properties
The Subwcrev Command Line
VC automatic generation software version number