Iis6Website Class

MSBuild Extension Pack

Iis6Website Class MSBuild Extension Pack Help 4.0.12.0
Valid TaskActions are:

Create (Required: Name Optional: Force, Properties, Identifier OutPut: Identifier)

CheckExists (Required: Name Output: Exists)

Continue (Required: Name)

Delete (Required: Name)

GetMetabasePropertyValue (Required: Name, MetabasePropertyNameOutput: MetabasePropertyValue)

Start (Required: Name)

Stop (Required: Name)

Pause (Required: Name)

Remote Execution Support: Yes. Please note that the machine you execute from must have IIS installed.

Inheritance Hierarchy

SystemObject  Microsoft.Build.UtilitiesTask
    MSBuild.ExtensionPackBaseTask
      MSBuild.ExtensionPack.WebIis6Website

Namespace: MSBuild.ExtensionPack.Web
Assembly: MSBuild.ExtensionPack (in MSBuild.ExtensionPack.dll) Version: 4.0.0.0

The Iis6Website type exposes the following members.

Constructors

  NameDescription
Public methodIis6Website
Top
Properties

  NameDescription
Public propertyExists
Gets whether the website exists.
Public propertyForce
Set force to true to delete an existing website when calling Create. Default is false.
Public propertyIdentifier
Gets or sets the Identifier for the website. If specified for Create and the Identifier already exists, an error is logged.
Public propertyMetabasePropertyName
Sets the Metabase Property Name to retrieve. See Metabase Property Reference (IIS 6.0)

Public propertyMetabasePropertyValue
Gets the string value of the requested MetabasePropertyName
Public propertyName
Gets or sets the name.
Public propertyProperties
Sets the Properties. Use a semi-colon delimiter. See Metabase Property Reference (IIS 6.0)

Some properties may be split within the semi colon, e.g. to set multiple server bindings you could use Properties="ServerBindings=:80:first.host.header|:80:second.host.header" If a property contains =, enter #~# as a special sequence which will be replaced with = during processing

Public propertySleep
Set the sleep time in ms for when calling Start, Stop, Pause or Continue. Default is 250ms.
Top
Examples

<Project ToolsVersion="4.0" DefaultTargets="Default" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    <PropertyGroup>
        <TPath>$(MSBuildProjectDirectory)\..\MSBuild.ExtensionPack.tasks</TPath>
        <TPath Condition="Exists('$(MSBuildProjectDirectory)\..\..\Common\MSBuild.ExtensionPack.tasks')">$(MSBuildProjectDirectory)\..\..\Common\MSBuild.ExtensionPack.tasks</TPath>
    </PropertyGroup>
    <Import Project="$(TPath)"/>
    <Target Name="Default">
        <!-- Create a website -->
        <MSBuild.ExtensionPack.Web.Iis6Website TaskAction="Create"  Name="awebsite" Force="true" Properties="AspEnableApplicationRestart=False;AspScriptTimeout=1200;ContentIndexed=False;LogExtFileFlags=917455;ScriptMaps=;ServerBindings=:80:www.free2todev.com;SecureBindings=;ServerAutoStart=True;UseHostName=True"/>
        <!-- Pause a website -->
        <MSBuild.ExtensionPack.Web.Iis6Website TaskAction="Pause" Name="awebsite" />
        <!-- Stop a website -->
        <MSBuild.ExtensionPack.Web.Iis6Website TaskAction="Stop" Name="awebsite" />
        <!-- GetMetabasePropertyValue -->
        <MSBuild.ExtensionPack.Web.Iis6Website TaskAction="GetMetabasePropertyValue" Name="awebsite" MetabasePropertyName="ServerState">
            <Output PropertyName="WebsiteState" TaskParameter="MetabasePropertyValue"/>
        </MSBuild.ExtensionPack.Web.Iis6Website>
        <Message Text="WebsiteState: $(ServerState)"/>
        <!-- Start a website -->
        <MSBuild.ExtensionPack.Web.Iis6Website TaskAction="Start" Name="awebsite" />
        <!-- Check whether a website exists -->
        <MSBuild.ExtensionPack.Web.Iis6Website TaskAction="CheckExists" Name="awebsite">
            <Output PropertyName="SiteExists" TaskParameter="Exists"/>
        </MSBuild.ExtensionPack.Web.Iis6Website>
        <Message Text="Website Exists: $(SiteExists)"/>
        <!-- Check whether a website exists -->
        <MSBuild.ExtensionPack.Web.Iis6Website TaskAction="CheckExists" Name="anonwebsite">
            <Output PropertyName="SiteExists" TaskParameter="Exists"/>
        </MSBuild.ExtensionPack.Web.Iis6Website>
        <Message Text="Website Exists: $(SiteExists)"/>
    </Target>
</Project>
See Also

Reference