tags:

views:

133

answers:

2

Hi

In my org, we are planning to go for nant for .net web applications. Source control is TFS, visual studio 2008. I would like to know how to do Builds with Nant? How to create msi and deploy the application using Nant? Is separate Build machine is required to do builds with nant? Somebody please help me out. I need step wise process. Thanks in advance.

Thanks Shanthi

+1  A: 

For a step-by step guide to using NAnt I suggest referring to the NAnt project documentation for the fundamental concepts. Once you are familiar with it's basic usage I suggest investigating the nant-contrib project to obtain more build tasks.

One part of your question that I would like to address directly here is the question of whether a separate machine is required to use NAnt. NAnt does not strictly require a separate machine, however a separate machine might be beneficial if your build process is automated or particularly intensive

[Update]

In response to comment from OP: NAnt views the build process as a series of individual tasks to be performed as part of a target. The normal process for building an application would be to invoke a compiler on the source files in order to produce a binary, NAnt has a number of tasks that invoke language compilers

In this example I will invoke the C# language compiler (csc.exe) using the task in an NAnt build file for a Hello World application that consists of a single source file named hello.cs.

 <?xml version="1.0"?>
<project name="Hello World" default="build" basedir=".">
    <property name="debug" value="true" overwrite="false" />
    </target>
    <target name="build" description="compiles the source code">
        <csc target="exe" output="HelloWorld.exe" debug="${debug}">
            <sources>
                <includes name="HelloWorld.cs" />
            </sources>
        </csc>
    </target>
</project>

Let's examine this XML:

<project name="Hello World" default="build" basedir=".">

Things to Note:

  • The value of the default property is "build". This means that the target named "build" will be invoked if no other target is specified.

  • This is the build target, as the description states it will compile the source code. To do this the csc task is used. The csc task has a number of options including

  • target: This specifies the type of binary the target will produce. In this case an executable will be produced

  • output: specifies the name of the executable file that will be created

  • debug: The value of this property used a conditional property debug (defined above as false) which will determine whether the compiler produces an executable that contains debugging information

  • sources & include: specifies the source files that the compiler will parse in order to produce the executable

As you can see the actions necessary to build the source code are defined in a target. A build file can define many targets which each call many tasks. To produce an MSI file you would inoke a task that produces an MSI file, unfortunately as I don't actually use NAnt regularly, you will have to do some research to find one although I have a feeling the nant-contrib project includes one given how common it is to produce an MSI.

I hope this explanation as clarified things for you

The information in this update has been distilled from this document in the NAnt documentation

Crippledsmurf
Thanks for the answers. I already referred the documents, but still it’s not clear to me. I want to know how nant will compile the source code and create msi? If you have any document which u followed for nant? Can you send it to me please.
Iwould like to note that my answer is very much a regurgitation of the NAnt documentation, and while I am aware of, and fully appreciate that stack overflow is not the place for such activity I felt compelled to assist the OP here because I had already begun to do so
Crippledsmurf
thanks alot for the clarification. very useful.
A: 

Seperate build machine is not necessarily required, but it's definetely recommended.

You'll want to look into using the following tools:

The Matt