How to fill revision number with TortoiseSVN and Visual Studio

Step 1

Create template file and resulting file, include resulting file into project. Example below shows cshtml files but they can be text files of any type.

Step 2

Create bat-file _update_version.bat and add it to the pre-build event in project properties of Visual Studio.

cd $(ProjectDir)
_update_version.bat

Use subwcrev utility provided by TortoiseSvn.

An example of bat-file.

subwcrev . Views\Mobile\AboutTmpl.cshtml Views\Mobile\About.cshtml
set ERRORLEVEL=0

Step 3

Put into template files keywords which will be replaced by subwcrev utility

Rev. $WCREV$
Last updated $WCDATE=%d %b %Y at %H:%M:%S$

Step 4

Rebuild project.

The SubWCRev Program

How to fill build number with Visual Studio

Advertisements