Hi folks, Its funny someone should raise this now. I've started writing a bunch of tasks to do things like dependency and build output management. So far I have three tasks with another three to come to close the loop.
<?xml version="1.0" encoding="utf-8" ?> <project name="ProductA" default="ProductA"> <target name="ProductA"> <foreach item="File" property="versionfile"> <in> <items> <includes name="Source\**AssemblyVersionInfo.cs" /> </items> </in> <do> <copy file="Templates\AssemblyVersionInfo.cs" tofile="${versionfile}" overwrite="true" /> <replacetext filename="${versionfile}" oldvalue="<version_number>" newvalue="1.0.1.0" /> </do> </foreach> <downloaddependencies destinationpath="Dependencies" sourcepath="C:\Work\Outputs" productname="SampleCompany" componentname="ProductA" versionfilter="1.0.*.*" filegroup="Release" /> <exec program="C:\Program Files\Microsoft Visual Studio .NET 2003\Common7\IDE\devenv.com" commandline="Source\ProductA\ProductA.sln /rebuild Release" /> <uploaddependencies destinationpath="C:\Work\Outputs" productname="SampleCompany" componentname="ProductA" versionnumber="1.0.0.0" filegroup="Release"> <fileset basedir="C:\Work\Sandboxes\SampleCompany\ProductA"> <includes name="Source\ProductA\ProductA.Project1\bin\Release\ProductA.Project1.dl l" /> <includes name="Source\ProductA\ProductA.Project2\bin\Release\ProductA.Project2.dl l" /> <includes name="Source\ProductA\ProductA.Project3\bin\Release\ProductA.Project3.dl l" /> </fileset> </uploaddependencies> </target> </project> So that's three tasks <replacetext />, <downloaddependencies />, and <uploaddependencies />. The first one is probably general enough to be useful in the standard NAnt distribution, but the other two are a little bit more specific to my general philosophy on build output management. Basically I have a directory structure like the following: SampleCompany\ ProductA\ 1.0.0.0\ Debug\ Release\ 1.0.1.0\ Debug\ Release\ 1.0.2.0\ Debug\ Release\ The upload and download tasks are used to put and get files from this structure. Perhaps the most interesting one is download dependencies which will go for the latest match it can get on the versionfilter attribute. It allows build scripts to automatically link in dependencies to get the latest build of a particular major.minor revision, which in theory should stop interfaces breaking etc. The next three tasks which I plan on producing might be of more general use: <xmlpeek filename="<path to xml file>" path="<xpath expression to find element or attribute>" property="<property to populate with value>" /> <xmlpoke filename="<path to xml file>" path="<xpath expression to find element or attribute>" value="<property to get the new value from>" /> <incrementversion property="<property holding a valid version number string>" part="build" /> The idea here is that with these three tasks you can do things like maintain a build version file in a project configuration file. I learned yesterday that Visual Build actually keeps a build number in the .bld file, and I was contemplating using the above tasks to emulate that by using the peek and poke commands to set some global project properties. I would be interested in peoples thoughts on this. These new tasks combined with the stock standard NAnt tasks pretty much take care of the whole build versioning process. I'll happily donate what I can (if anyone is interested). But it will have to wait until I can rewrite what I have to comply with the NAnt project coding standards and unit test requirements. ---------------------------------------- - Mitch Denny - [EMAIL PROTECTED] - http://www.monash.net - +61 (414) 610141 - > > -----Original Message----- > From: Jaroslaw Kowalski [mailto:[EMAIL PROTECTED] > Sent: Wednesday, September 17, 2003 3:33 AM > To: Daniel Nguyen; [EMAIL PROTECTED]; > [EMAIL PROTECTED] > > You can use my trick: > > The technique consists of: > > 1. A plain text file that holds nothing but a version number > AA.BB.CC.DD (version.txt) 2. A small C# utility that > increments one of the components in the file (NewBuild.exe) > 3. A small C# utility that replaces AssemblyVersion(...) in > all AssemblyInfo.cs files in your project > (ReplaceVersion.exe) 4. A few NAnt targets to automate the > above (sample.build) > > I keep binaries of NewBuild.exe and ReplaceVersion.exe in CVS > as they are ultra-small (4KB each). Plus, they are portable > because they are CLI executables. > > You can invoke the targets: > > nant updateversion > > which update all AssemblyInfo.cs files according to > "version.txt" contents. > > nant newbuild > > which will increase the fourth component of "version.txt" and > update all AssemblyInfo.cs files > > nant newrevision > > which will increase the third and fourth component of > "version.txt" and update all AssemblyInfo.cs files > > nant newminor > > which will increase the second and fourth component of > "version.txt", zero the third one and update all AssemblyInfo.cs files > > nant newmajor > > which will increase the first and fourth component of > "version.txt", zero the second and third one and update all > AssemblyInfo.cs files > > Jarek > > P.S. Because I keep my "version.txt" as plain as possible, I > am even able to parse individual components from my nant > buildfile. I can simply use <foreach> with the delimiter set > to a dot and because there's only one line - foreach iterates > just one time. > > ----- Original Message ----- > > From: Daniel Nguyen <mailto:[EMAIL PROTECTED]> > To: [EMAIL PROTECTED] ; > [EMAIL PROTECTED] > Sent: Tuesday, September 16, 2003 6:57 PM > Subject: [Nant-users] How do one update the > AssemblyVersion build number? > > > > Greeting, > > My apologies in advance if the following questions have > been asked before. But, does anyone know how to increase the > AssemblyVersion build number everytime it builds? Does NAnt > has any task to take care of this? > > Example: [assembly: AssemblyVersion("2003.1.0.0")] > > The number I want to increase is the 3rd digit in the > AssemblyVersion. Any help would be greatly appreciated. > > Daniel Nguyen > Lanmark Graphics Corporation > [EMAIL PROTECTED] > > > > > > > ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ Nant-users mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/nant-users