NANT task <exec program="CMD.EXE" exception:

When you use NANT to execute a bat file, use the <arg … /> tag to set parameters and use the workingdir to change the current path location, like: <exec program="CMD.EXE" commandline="/C DatabaseInstallation.cmd" workingdir="${installPath}"> <arg value="${Database_ServerInstanceName}" /> <arg value="${Database_Name}"/> <arg value="${Database_Domain}"/> <arg value="${Database_DtsPackagesFolder}"/> </exec> If you use it like: <exec …

Delete IIS6 or IIS7 virtual directory on a website with hostheader, with C# and NANT

using System; using System.DirectoryServices; using System.Globalization; using Ada.Configurator.Common; using NAnt.Core.Attributes; using NAnt.Core; namespace AdaNantTasks { /// <summary> /// Delete an IIS virtual directory on a website with a hostheader. /// </summary> [TaskName(“deleteVirtualDirectoryTask”)] public class DeleteVirtualDirectoryTask : Task { public NantLogger logger = new NantLogger(); public string VirDirSchemaName = “IIsWebVirtualDir”; private …

Create IIS6 or IIS7 virtual directory on a website with hostheader, with C# and NANT

using System; using System.DirectoryServices; using System.Globalization; using Ada.Configurator.Common; using NAnt.Core.Attributes; using NAnt.Core; namespace AdaNantTasks { [TaskName(“createWebSite”)] public class CreateWebsiteTask : Task { public NantLogger logger = new NantLogger(); private string m_server; [TaskAttribute(“server”, Required = true)] [StringValidator(AllowEmpty = false)] public string Server { get { return m_server; } set { m_server …

Dump IIS info with C#

To call the function use:  this.DumpIISInfo(new DirectoryEntry(“IIS://localhost/w3svc”)); /// <summary> /// Dump iis info /// </summary> /// <returns> /// 0 = All IIS information is written to the console /// 1 = Parameter entry was null /// </returns> public int DumpIISInfo(DirectoryEntry entry) { if (entry == null) { return 1; } …

Determine if an IIS website or IIS virtualdirectory exist, that run under a given applicationpool, with C#

To call this function use: DoesAppPoolHaveWebsites(new DirectoryEntry(string.Format(“IIS://{0}/w3svc”, “localhost”)), “appPoolName”)   /// <summary> /// Determine if a IIS website running under an applicationpool exists. /// </summary> /// <returns></returns> public bool DoesAppPoolHaveWebsites(DirectoryEntry iisEntry, string appPoolName) { bool result = false; if (iisEntry == null) { throw new Exception(“Parameter [iisEntry] can’t be null …

How to list all IIS applicationpools and properties, with C#

/// <summary> /// List all properties of an IIS applicationpool /// </summary> /// <param name=”serverName”>Name of the IIS server e.g. localhost</param> /// <param name=”appPoolName”>Name of the applicationpool e.g. test</param> public void ListAppPoolProperties(string serverName, string appPoolName) { if (string.IsNullOrEmpty(serverName)) { throw new Exception(“Parameter [serverName] can’t be null or empty”); } if …

How to determine if an IIS website contains virtualdirectories, with C#

/// <summary> /// Does the given IIS website contain virtualdirectories. /// </summary> /// <returns></returns> public bool DoesWebsiteContainVirtualDirectories(string website) { if (string.IsNullOrEmpty(website)) { throw new Exception(“Parameter [website] can’t be null or empty”); } bool result = false; DirectoryEntry w3svc = new DirectoryEntry(“IIS://localhost/w3svc”); foreach (DirectoryEntry site in w3svc.Children) { if (site.Properties[“ServerComment”] != …

NANT: Build Microsoft VisualStudio solutions and configure environments

I use NANT to build Microsoft VisualStudio solutions and after deploying software with msi packages, I use NANT to configure the environment (Creating WebSite, Virtual Directories, Custom Eventlogs, register services, create folders, create shares etc) More information on NANT can be found, here: http://nantcontrib.sourceforge.net/, including documentation for task, types and …