Albacore AssemblyInfo Task vs. Nant Assembly Info Generator

Here’s one of the reasons I like Rake and my custom Rake tasks that I’m building into Albacore, so much.

To generate some assembly information such as version, company name, copyright, etc., you need to do this with nant:

   1: <?xml version="1.0"?>

   2: <project name="Assembly Version Info Generator" default="buildVersionInfo" basedir=".">

   3:     <target name="buildVersionInfo">

   4:         <asminfo output=".SomeFolderAssemblyInfo.cs" language="CSharp">

   5:             <imports>

   6:                 <import namespace="System.Reflection" />

   7:             </imports>

   8:             <attributes>

   9:                 <attribute type="AssemblyCompanyAttribute" value="MyCompany, Inc." />

  10:                 <attribute type="AssemblyProductAttribute" value="MyProduct" />

  11:                 <attribute type="AssemblyVersionAttribute" value="" />

  12:                 <attribute type="AssemblyCopyrightAttribute" value="Copyright (c)2009 MyCompany, Inc. All Rights Reserved." />

  13:             </attributes>

  14:         </asminfo>

  15:     </target>

  16: </project>

</div> </div>

To do the same thing with Albacore, you only need this:

   1: desc "Assembly Version Info Generator"

   2: do |asm|

   3:     asm.output_file = "./SomeFolder/AssemblyInfo.cs"

   4:     asm.company_name = "MyCompany, Inc."

   5:     asm.product_name = "MyProduct"

   6:     asm.version = ""

   7:     asm.copyright = "Copyright (c)2009 MyCompany, Inc. All Rights Reserved."

   8: end

</div> </div>

I’ll take the half-the-size, easier-to-read lines of no angle-bracket-tax where I can write real code, any day.

Albacore: A Suite Of Rake Build Tasks For .NET Solutions