Pre-requisites: Tortoise SVN, Visual Studio
- Exclude the existing “AssemblyInfo.cs” file from Subversion
- Rename “AssemblyInfo.cs” to “AssemblyInfo.template“
- Add the Subversion revision keyword to the template file. For example: [assembly : AssemblyVersion("1.0.0.$WCREV$")]
- Add SubWCRev.exe from the TortoiseSVN bin directory to the project (or add the Tortoise SVN bin folder to your path)
- In the pre-build event for your project, add the following line (You may need to adjust it to your own project structure):
“$(SolutionDir)\lib\SubWCRev\subwcrev.exe” “$(SolutionDir).” “$(ProjectDir)Properties\AssemblyInfo.template” “$(ProjectDir)Properties\AssemblyInfo.cs”
- Done! The “AssemblyVersion.cs” file should now be auto-generated on every build and the $WCREV$ keyword is replaced with the current SVN revision number on the solution directory.