开发者

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 t开发者_如何学JAVAo 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


  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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜