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 existi开发者_如何学JAVAng 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.
精彩评论