Wednesday, March 14, 2007

MSDN Magazine Lag Time

I have been reading MSDN Magazine (and it’s predecessors MSJ and Visual Developer) for a number of years now.

Until recently there has been upto a 5 year lag between an article being written and being able to use it in anger.

Today I finally found a use for an article written in June last year (only 8 months behind)!

A really useful feature  especially when combined with  Code Generation:

(I have given up on adding tags around XML) 

ItemGroup
    Compile Include="*.cs"
/ItemGroup

This allows code to be added to the project without having to explicitly edit the project file.  

Posted by chriseyre2000 at 21:58:55 | Permalink | No Comments »

Saturday, March 3, 2007

Open Source Library of MSBuild Tasks

This is a collection of Open Source MSBuild tasks.

These are licenced under the BSD.

Posted by chriseyre2000 at 17:29:56 | Permalink | No Comments »

Boo and MSBuild

Msbuild is microsofts answer to Ant. This is a build tool for the .Net Platform.

It has the minor benfit of being the native file format of the Visual Studio 2005 project files.

You need the .Net Framework 2 installed and to add the Microsoft Framework to your path statement

Boo is a lightweight .Net language.

Here is a sample that gets a task written in Boo for msbuild:

=== MyTask.boo ===

import Microsoft.Build.Framework
import Microsoft.Build.Utilities
import Boo.Lang

class MyTask(Task):
    public override def Execute():
        Log.LogMessage(MyProperty)
            return true

    private _MyProperty as string

    MyProperty as string:
        get:
                    return _MyProperty
             set:
                    _MyProperty = value 

=== Test.proj ===

<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" 
         DefaultTargets="MyTarget"
         InitialTargets="BuildMyTask"
>

    <Target Name="BuildMyTask">
        <Exec command="booc MyTask.boo -t:library"/>
    </Target>

    <UsingTask TaskName="MyTask" AssemblyFile="MyTask.dll"/>

    <Target Name="MyTarget">
        <MyTask MyProperty="Hello!"/>
    </Target>
</Project> 

===

You also need Boo installed (and on your path).
Copy Boo.Lang into the directory that you created these scripts in.

At the command line type: msbuild
This will build and run the minimal boo task.
I am planning to add a real msbuild task for boo.
Posted by chriseyre2000 at 09:15:04 | Permalink | No Comments »