3

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

sll
  • 61,540
  • 22
  • 104
  • 156
Ivo
  • 3,406
  • 4
  • 33
  • 56

1 Answers1

2
  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.

sll
  • 61,540
  • 22
  • 104
  • 156