Visual Studio 2008 and NAnt

Most article suggest to script a build task using NAnt so that you can build your application from the command line. But why repeat yourself when the Visual Studio 2008 has already build it’s solution for you. Isn’t it doesn’t conform to the DRY principle?

So, in order to make NAnt and VS 2008 work together DRY-ly. We are going to need NAntContrib. So after you download NAnt Contrib, install it together with NAnt (I recommend their install method #2).

Here it is:

2. Copy the content of the NAntContrib bin directory to the NAnt directory

In order to make certain tasks available to every build file, you can copy the tasks assembly and
all its non-assembly dependencies to the "<nant>\bin\tasks" directory, and copy the assembly
dependencies to the "<nant>\bin\lib" directory.

However, as NAntContrib contains tasks that rely on COM Interop, it is only supported on the .NET
Framework (not on Mono). So, in order to avoid issues when running NAnt on Mono, you should copy
the content of the NAntContrib bin directory to "<nant>\bin\tasks\net" and "<nant>\bin\lib\net".
This will ensure that NAnt only loads the NAntContrib tasks when running on one of the MS .NET
Framework runtimes.

You should eventually end up with the following directory structure:

<nant>\
    bin\
        lib\
            net\
                CollectionGen.dll
                Interop.MsmMergeTypeLib.dll
                Interop.StarTeam.dll
                Interop.WindowsInstaller.dll
                SourceSafe.Interop.dll

        tasks\
            net\
                MSITaskErrors.mst
                MSITaskTemplate.msi
                MSMTaskErrors.mst
                MSMTaskTemplate.msm
                NAnt.Contrib.Tasks.dll
                NAnt.Contrib.Tasks.pdb (not available for releases)
                NAnt.Contrib.Tasks.xml

        SLiNgshoT.Core.dll
        SLiNgshoT.exe

Note: you might have to manually create the "tasks\net" and "lib\net" directories.

References

No Responses to “Visual Studio 2008 and NAnt”

You can subscribe to the RSS feed for comments on this post. You can also reply to this post directly in your weblog, and take advantage of the TrackBack URI to record your reply in this post.

  1. No comments posted yet

Leave a comment

Line and paragraph breaks automatic, e-mail address never displayed, HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>