Hi everyone, I've knocked together a little build framework called NBuild (what an exciting name) that compiles and executes C# build scripts. Extending it to compile VB.NET build scripts should be easy if C# isn't your cup of tea.
The format is similar to Gerry Shaw's comment (http://www.iunknown.com/000472.html) on John Lam's blog, except it makes more use of attributes to markup targets and dependencies (as Ian MacLean suggested in a previous post to nant-users). Here's a rough example: - using Eurosoft.NBuild; using NAnt.DotNet.Tasks; using NAnt.SourceControl.Tasks; using System.IO; [BuildFixture(Name = "My Project", DefaultTarget = "build")] public class MyBuildScript { [BuildTarget("build", Dependencies = "init")] public void Build(NBuild build) { // Call through to NAnt compiler tasks. } [BuildTarget("checkout")] public void Checkout(NBuild build) { Console.WriteLine("Checking out from CVS root: {0}", build.Options["CvsRoot"]); // Call through to NAnt source control tasks. } [BuildTarget("init")] public void Initialise(NBuild build) { Directory.CreateDirectory("bin"); Directory.CreateDirectory("lib"); } } C# build scripts are searched for with the pattern *.csbuild to differentiate them from NAnt *.build scripts. To invoke the default target of the project: - Eurosoft.NBuild.exe To invoke the 'checkout' target with a build option: - Eurosoft.NBuild.exe checkout CvsRoot=:pserver:[EMAIL PROTECTED]:/cvs You'll need to play with the ReferencedAssemblies key in the app.config file to make it point to your copy of Eurosoft.NBuild.exe and to your NAnt and NUnit assemblies if you want to be able to use those classes from within your build scripts. The value of this key is a semicolon separated list (like the PATH environment variable) of assemblies to reference when compiling your build script. Unfortunately I found the only way to use a NAnt task is to setup a fake Project object as all(?) tasks require their Project property to be set before calling their Execute method. Anyway, if you're still interested you can get a copy of the project here: - http://www.sycora.net/Eurosoft.NBuild/Eurosoft.NBuild.zip Naturally Eurosoft accepts no liability for damages, fatalities, fires, explosions, etc. Like I said, it was *knocked* together (and mostly just as an academic exercise anyway). Enjoy! :) Cheers, Richard. DISCLAIMER: The information contained in this e-mail is confidential and may be privileged. It is intended for the addressee only. If you are not the intended recipient, please delete this e-mail immediately. The contents of this email must not be disclosed or copied without the sender's consent. We cannot accept any responsibility for viruses, so please scan all attachments. The statements and opinions expressed in this message are those of the author and do not necessarily reflect those of the company. The company does not take any responsibility for the views of the author. ------------------------------------------------------- SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media 100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33 Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift. http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285 _______________________________________________ Nant-users mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/nant-users
