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

0 Comments

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

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

0 Comments

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

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

2 Comments

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)]

Dump IIS info with C#

0 Comments

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

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

0 Comments

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

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

0 Comments

/// <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)

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

0 Comments

/// <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 =

Using quotes in XML

0 Comments

To use quotes in xml, use “&quot;“ <exec program="CMD.EXE" commandline="/C &quot;${installPath}\DatabaseInstallation.cmd&quot;" workingdir="${installPath}"> <arg value="${Database_DataSource}" />