简体   繁体   中英

How to read existing assembly version from AssemblInfo.cs files, increment and update the new version using Team Build via TFS 2008?

I need to implement auto-increment for each nightly builds.

For this, i need to read existing version, increment only the build number and save the incremented build number to assemblyinfo.cs files as well as some custom xml files having the following syntax.

<?xml version="1.0" encoding="utf-8"?>
<MyProduct>
  <Version>v.3.0.13</Version>
  <Build>3.0.13</Build>
</MyProduct>

I am having trouble to read existing version and build number separately. I could increment build number using the Sdc.Sum Task from Microsoft.Sdc task but there is a problem while trying to read the assembly version.

Kindly help

Thanks

Got the solution, First i checked out the required .xml and assemblyinfo. files

the problem was solved using Microsft.SDc.tasks and using the Version task and a proper XPath query, the version was easily read.

using Math.Sum from Microsoft.Sdc or Math.Add from MsBuild Community tasks increment can be performed on any of the single variable that may represent, lets say build number...

using File.Replace task i was able to change the build number for each nightly build and used a regular expression to match and change version not only in the xml files but also in the assemblyinfo.* files.

Finally i checked in the changes

All the above tasks were performed in the Afterget Target.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM