Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

File transformation, is it possible to add autoincrement to a setting

In our automatic build we use MSBuild in combination with web.config transformation to create an acceptance config and a production config.

We have added attributes to change config settings

for example to change the cdn url's.

<add key="cdn1url" value="http://cdn.acceptance.oursite.com/"
                   xdt:Transform="SetAttributes" 
                   xdt:Locator="Match(key)" />

Does anybody know if it is possible to add an autoincrement attribute? We want to add +1 to the version attribute (for css/img/js caching) on every production build.

An other option could be the Teamcity build number, but I am not sure if that is possible

like image 420
Ivo Avatar asked Nov 21 '25 01:11

Ivo


1 Answers

  1. You already have the Current or even Next Version number as msbuild property value - see 3
  2. You do not have it -> see PS at the bottom and then back to 3
  3. You can do it using FileUpdate task by providing a regexp and replacement text with a new version number:

 <FileUpdate
      Files="@(FilesToUpdate)"
      Regex="regex here"
      ReplacementText="$(NextVersionNumber)" />

PS: By using RegexMatch task you can extract current version and then by incrementing it you'll get a value for the $(NextVersionNumber) proeprty.

like image 127
sll Avatar answered Nov 22 '25 16:11

sll



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!