NAnt Solutions and Best Practices for Windows Environment

Download Presenatation
slide1 n.w
1 / 13
Embed
Share

Explore NAnt solutions and best practices for Windows environment, including tips on clearing subdirectories without removing them, running Windows 'rm' command, echoing messages with new lines, removing folders recursively, handling target failures, setting project directory, and starting/stopping IIS websites conveniently.

  • NAnt
  • Windows Environment
  • Solutions
  • Best Practices
  • IIS

Uploaded on | 0 Views


Download Presentation

Please find below an Image/Link to download the presentation.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.

You are allowed to download the files provided on this website for personal or commercial use, subject to the condition that they are used lawfully. All files are the property of their respective owners.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.

E N D

Presentation Transcript


  1. LAB

  2. Clear all subdirectories, but not remove them in NAnt

  3. Solution <delete> <fileset basedir="\\${conf.server.frontend}\wwwroot" > <include name="**\*" /> </fileset> </delete>

  4. How to run Windows 'rm' command from NAnt?

  5. Solution <exec> <executable>$(windir)\system32\cmd</executable> <buildArgs>/c "rm somefile.txt"</buildArgs> </exec>

  6. echo message with new line in nant Use function ${environment::newline()}

  7. How to remove a folder recursively? To remove all folder named .svn recursively in a given folder. <delete> <fileset defaultexcludes="false" > <include name="**/.svn/**" /> </fileset> </delete>

  8. How to call a target when another target fails in NAnt? <trycatch> <try> <call target="A" /> </try> <catch> <call target="B" /> </catch> </trycatch>

  9. How to set a NAnt project's basedir to the current directory? <project basedir="."> </project

  10. Start/Stop IIS website using Nant To stop/start website on IIS using Nant without stopping full service? <target name="start" > <exec program="C:\Windows\system32\inetsrv\appcmd.exe" > <arg line='start' /> <arg line='sites' /> <arg line='SiteName' /> </exec> </target>

  11. <msbuild> task or msbuild.exe with NAnt? <property name="MSBuildPath" value="C:\WINDOWS\Microsoft.NET\Framework\v3.5\MSBuild.exe"/> <target name="build"> <exec program="${MSBuildPath}"> <arg line='"${SolutionFile}"' /> <arg line="/property:Configuration=${SolutionConfiguration}" /> <arg value="/target:Rebuild" /> <arg value="/verbosity:normal" /> <arg value="/nologo" /> <arg line='/logger:"C:\Program Files\CruiseControl.NET\server\ThoughtWorks.CruiseControl.MsBuild.dll"' /> </exec> </target>

  12. <target> <loadtasks assembly="${nant::get-base- directory()}/../../nantcontrib- 0.85/bin/NAnt.Contrib.Tasks.dll" /> <msbuild project="${filepath.root}/yourproject.csproj" verbose="true"> <arg value="/p:Platform=${build.platform}" /> <arg value="/t:Rebuild" /> <arg value="/p:OutputPath=${build.dir}/bin/" /> </msbuild> </target>

More Related Content