I am trying to set up an auto-versioning update on TortoiseSVN for a project I’m working on. It’s very straightforward; the code is supposed to pull the SVN revision and display the date & location whenever anyone does a checkout/update from the repo.
Below I have a template class
public static class SvnRevision
{
/// <summary>
/// SVN repo revision
/// </summary>
public const string REVISION = "$WCREV$";
/// <summary>
/// SVN repo location
/// </summary>
public const string REPOSITORY_URL = @"$WCURL$";
/// <summary>
/// SVN repo date
/// </summary>
public const string REPOSITORY_DATE = "$WCDATE$";
}
I want to know the background steps necessary to get this program to work. Appreciate if anyone could provide a walk through or tutorial. I am trying to do this on Visual Studio 2022.
I made commits using this class to SVN without any luck, a search indicates that I need to set up versioning and provide some kind of source/destination files that I don’t know how to do. Below is a link I’ve referenced.
https://docs.huihoo.com/tortoisesvn/1.5.7-en/tsvn-subwcrev-keywords.html
2
Answers
Thanks for all the help everyone. Likely my line of questioning was not clear or I worked it wrong, but the problem was that I needed to set a command line as a prebuild event so that the SVN keywords would update.
Prebuild event command line: "C:Program FilesTortoiseSVNbinSubWCRev.exe" "$(ProjectDir)." "$(ProjectDir)SvnRevision_Template.cs" "$(ProjectDir)SvnRevision.cs"
Before selecting The Right Thing ™ for your task and|or using SubWCRev (which you try to use, according to used subwcrev-specific keywords) you have to know some things
svn info
tells it, instead of reading your code or compiling it in order to see message-box with collected dataIn your case you can
public static class SvnRevision
intosomename.cs.tpl
with all needed keywordsSubWCRev.exe pathtoWC somename.cs.tpl somename.cs
somename.cs
, which also have to be in svn-ignore and not versioned, while template have to be versionedHTH