I want the TortoiseSVN revision number to be available for reading from my MVC C# app (Using MS Visual Studio 2019)
I need to know how to get Tortoise to write the revision number of a repository to
I do not know how to setup tortoise to even write a test file upon commit
I've searched the web and found "The SubWCRev Command Line" but I have no clue how to make this work from when I commit the code ?! (consider me a newbie with tortoise)
If someone has some form of example, simple example easy to follow (remember ...newbie with tortoise), it would be greatly appreciated
Or ... if there is another way to do this like a class that could read the .svn properties (?) I am all ears
Thanks for reading my question even if you have no suggestion :)
PS
I am in the process ro migrating to TeamsFoundations TFS server, now if someone knows how to get the revision number from that TFS, this will be just great
Finally figured it out.
First of all it is not Tortoise that writes to my Project file, but the project running a Tortoise command line upon running a "build" that reads the version number, and then updates the AssemblyInfo.cs with the use of the template:AssemblyInfoTemplate.cs
The project's layout file then reads he assemblyinfo and displays it
<div class="col-lg-6">© Tortoise V# @ViewContext.Controller.GetType().Assembly.GetName().Version</div>
first you needs a template called "AssemblyInfoTemplate.cs"
at the same level of AssemblyInfo.cs
and an exact duplicate
Modify the last three lines of code at the bottom of the AssemblyInfoTemplate.cs to look like this
:
[assembly: AssemblyVersion("1.0.0.$WCREV$")]
[assembly: AssemblyFileVersion("1.0.0.$WCREV$")]
[assembly: AssemblyInformationalVersion("Build date: $WCNOW=%Y-%m-%d %H:%M:%S$; Revision date: $WCDATE=%Y-%m-%d %H:%M:%S$; Revision(s) in working copy: $WCRANGE$$WCMODS?; WARNING working copy had uncommitted modifications:$.")]
So now upon building your project, the command line you put in the BuildEvent will get the Tortoise version number and update the AssemblyInfo file automatically every time… so always commit your changes in Tortoise before building, so you get the latest and the greatest version number 😉