Nant: Building and deploying cab files

It appears that there is no nant / nantcontrib task to create CAB files (ie build .vdproj projects). Nant seems to only be capable of handling C#, VB.NET and C++ projects. To overcome this, you need to call out to devenv.exe passing in parameters as follows (assuming you have visual studio installed on your nant server). The sample below only builds the specified project and its dependencies (not the entire solution). Note that the structure of arguments passed in my example could be improved.

<target name="buildcab" depends="build" description="builds the webpart cab files">
    <exec program="C:\Program Files\Microsoft Visual Studio .NET 2003\Common7\IDE\DevEnv.exe">
        <arg line="/build release /project myprojectname ${Build.OutputFolder}Codemy.solution.sln"  />
    </exec>
</target>

As a site note, I am installing these cabs into the Sharepoint Webpart gallery by using the following nant task (which calls stsadm):

<target name="installwebparts" depends="buildcab" description="installs the webpart cab files">
    <exec program="C:Program FilesCommon FilesMicrosoft Sharedweb server extensions60BINstsadm.exe">
        <arg line="-o addwppack -filename ${Build.OutputFolder}CodeMyProjectNamereleasesmyprojectname.CAB -force -globalinstall" />
    </exec>
</target>

You May Also Like

About the Author: rnowik

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.