views:

34

answers:

1

Does anyone know of a good resource for basic samples for both a NANT.Build file and a CCNet.Config file entry for nightly build on an ASP.net 4.0 application, having had a good look around online it appears that there's a lot of conjecture on how this should be done, but I'm looking for something sustainable.

I have projects that use .Net 2.0, .Net 3.5 and .Net 4.0 that all need to go through Cruise Control with Nant for nightly builds, so each needs to be individually configured, rather than just configuring Cruise Control for .Net 4.0, so am looking for the best practise here.

+2  A: 

If you have visual studio installed on your build machine, here is the approach you can take. I used to use NANT and MSBUILD for pretty much everything, however I got tired of hacking it when we upgraded frameworks.

I have doing configuration management with Nant and CC.Net for a while now. In my experience I would not recommed using the Nant MSBuild task, instead the easiest way is creating and task, create a .bat file that the task executes. There are several reasons that would recommend using the command line Visual Studio, for one MSI packages are not easily build with Nant, even if you use contrib. Its just way easier and a lot faster this way.

.bat file with this
---------2.0 ------------- "C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\devenv" C:\YourProject\YourSoultion.sln /Rebuild release

----------3.5-------------- "C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\devenv" C:\YourProject\YourSoultion.sln /Rebuild release

similar logic for 4.0

there is plenty of information about ccnet tasks here http://ccnet.sourceforge.net/CCNET/Configuring%20the%20Server.html

ccnet config example

    <tasks>
          <nant>
            <executable>C:\Nant\Nant0.86\bin\nant.exe</executable>
            <baseDirectory>.</baseDirectory>
            <buildFile>C:\NANT_SCRIPTS\build.xml</buildFile>
            <targetList>
              <target>DexWeb</target>
            </targetList>
            <buildTimeoutSeconds>2000</buildTimeoutSeconds>
          </nant>       
 </tasks>
    build.xml
    <target name="DexWeb">
        <exec program="C:\NANT_SCRIPTS\continous\dexbuild.bat" />
      </target> 
Kirit Chandran
Why use a .bat-file when you can `<exec/>` devenv.exe directly?
Peter Lillevold
I'm trying to remember why I used the .bat file, if I remember correctly it was because the version of NANT we were using didnt not resolve the spaces in the path correctly even if you used escape sequences and or quotations. This could be resolved now, its just habbit.
Kirit Chandran