Just how do I sync the SVN alteration number with my ASP.NET internet site?

Pile Overflow has a subversion variation number near the bottom:

svn alteration: 679

I intend to make use of such automated versioning with my .NET Web Site/Application, Windows Forms, WPD projects/solutions.

Just how do I implement this?

2019-05-07 00:28:45
Source Share
Answers: 4

We do this with xUnit.net for our automated builds. We make use of CruiseControl.net (and also are experimenting with TeamCity). The MSBuild job that we compete continual assimilation instantly transforms the construct number for us, so the resulting construct ZIP documents has an effectively versioned set of DLLs and also EXEs.

Our MSBuild file has a UsingTask reference for a DLL which does normal expression substitutes : (you rate to utilize this DLL, as it is covered by the MS - PL certificate too)


Next, we extract the construct number, which is given instantly by the CI system. You can additionally get your resource control carrier to give the resource alteration number if you desire, yet we located the construct # in the CI system was better, due to the fact that not just can see the assimilation results by the CI construct number, that additionally gives a link back to the changeset (s) which were consisted of in the construct.

 <!-- Cascading attempts to find a build number -->

 <PropertyGroup Condition="'$(BuildNumber)' == ''">
 <PropertyGroup Condition="'$(BuildNumber)' == ''">
 <PropertyGroup Condition="'$(BuildNumber)' == ''">

(We attempt BUILD_NUMBER, which is from TeamCity, after that ccnetlabel, which is from CC.net, and also if neither exists, we fail to 0, to make sure that we can examine the automated construct manuscript by hand.)

Next, we have a job which establishes the construct number right into a GlobalAssemblyInfo.cs documents that we link right into every one of our tasks :

 <Target Name="SetVersionNumber">
   <Exec Command="attrib -r xunit.installer\App.manifest"/>

This locate the AssemblyVersion feature, and also changes the a.b.c.d variation number with a.b.c.BuildNumber. We will generally leave the resource explored the tree with the first 3 components of the building contractor number dealt with, and also the 4th at absolutely no (f.e., today it is

In your construct procedure, see to it the SetVersionNumber job precedes your construct job. At the end, we utilize our Zip job to whiz up the construct outcomes to make sure that we have a background of the binaries for every single automated construct.

2019-12-03 01:55:54

$rev and also others like it are alterations for the specific documents, so they will not transform unless the documents adjustments. The number on the page is (more than likely, I'm thinking below) the svn alteration number for the entire task. That is various than the documents alterations, which others have actually been indicating.

In this instance I think that CCNET is drawing the alteration variety of the task and also revising a component of the page with that said number. Any kind of CI remedy need to have the ability to do this, set this up myself with CCNET and also Teamcity (although not pages, yet automated versioning of deployment/assembly variations).

In order for you to do this, make use of a CI remedy that sustains it, or utilize your construct procedure (MSbuild/Nant) to store that variation and also write it to the documents prior to "releasing" it.

2019-05-30 04:35:38

Looks like Jeff is making use of CruiseControl.NET based upon some scanning the podcast records. This appears to have actually automated release capacities from resource control to manufacturing. May this be where the insertion is taking place?

2019-05-08 19:44:06

You can do it by including the adhering to throughout your code


So as an example @Jeff did :

<div id="svnrevision">svn revision: $Id:$</div>

and also when signed in the web server changed $Id :$ with the existing alteration number. I additionally found this reference.

There is additionally $ Date :$ , $ Rev :$ , $ Revision :$

2019-05-08 19:39:08