Iis7Website Class

MSBuild Extension Pack

Iis7Website Class MSBuild Extension Pack Help 4.0.12.0
Valid TaskActions are:

AddApplication (Required: Name, Applications Optional: AppPool, EnabledProtocols, AnonymousAuthentication, BasicAuthentication, DigestAuthentication, WindowsAuthentication, sslFlagsForce)

AddMimeType (Required: Name, MimeTypes)

AddResponseHeaders (Required: Name, HttpResponseHeaders)

AddVirtualDirectory (Required: Name, VirtualDirectories Optional: Force)

CheckExists (Required: Name Output: Exists)

CheckVirtualDirectoryExists (Required: Name, VirtualDirectories Output: Exists)

Create (Required: Name, Path, Port Optional: Identifier, Force, Applications, VirtualDirectories, AppPool, EnabledProtocols, LogExtFileFlags, LogDirectory, LogFormat, AnonymousAuthentication, BasicAuthentication, DigestAuthentication, WindowsAuthentication, ServerAutoStart, ConnectAsUser, ConnectAsUserPassword)

Delete (Required: Name)

DeleteVirtualDirectory (Required: Name, VirtualDirectories)

GetInfo (Required: Name Output: SiteInfo, SiteId)

ModifyPath (Required: Name, Path Output: SiteId)

ModifyLogDirectory (Required: Name, LogDirectory)

SetWindowsAuthenticationProviders (Required: Name, Providers Optional: UseKernelMode)

Start (Required: Name)

Stop (Required: Name)

Remote Execution Support: Yes

Inheritance Hierarchy

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

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

The Iis7Website type exposes the following members.

Constructors

  NameDescription
Public methodIis7Website
Top
Properties

  NameDescription
Public propertyAnonymousAuthentication
Sets AnonymousAuthentication for the website. Default is true
Public propertyApplications
ITaskItem of Applications. Use AppPool, PhysicalPath and EnabledProtocols metadata to specify applicable values
Public propertyAppPool
Sets the app pool.
Public propertyBasicAuthentication
Sets BasicAuthentication for the website. Default is false;
Public propertyConnectAsUser
Sets the user of the application (instead of pass-throught authentication).
Public propertyConnectAsUserPassword
Sets the password of the application user (instead of pass-throught authentication).
Public propertyDigestAuthentication
Sets DigestAuthentication for the website. Default is false;
Public propertyEnabledProtocols
Sets the Enabled Protocols for the website
Public propertyExists
Gets whether the website exists
Public propertyForce
Set to true to force the creation of a website, even if it exists.
Public propertyHttpResponseHeaders
A collection of headers to add. Specify Identity as name and add Value metadata
Public propertyIdentifier
Gets or sets the Identifier for the website. If specified for Create and the Identifier already exists, an error is logged.
Public propertyLogDirectory
Sets the directory the website writes logfiles to.
Public propertyLogExtFileFlags
Sets the LogExtFileFlags. Default is 1414 (logextfiletime | logextfileclientip |logextfilemethod | logextfileuristem | logextfilehttpstatus)
Public propertyLogFormat
Sets the LogExtFileFlags. Default is W3c.
Public propertyMimeTypes
A collection of MimeTypes. Specify Identity as name and add Value metadata
Public propertyName
Sets the name of the Website
Public propertyPath
Sets the path.
Public propertyPhysicalPath
Gets the site physical path. [Output]
Public propertyPort
Sets the port.
Public propertyProviders
Sets the authentication providers. The authentication providers must be passed in a semicolon separated string.
Public propertyServerAutoStart
Sets ServerAutoStart for the website. Default is true.
Public propertySiteId
Gets the site id. [Output]
Public propertySiteInfo
Gets the SiteInfo Item. Identity = Name, MetaData = ApplicationPoolName, PhysicalPath, Id, State
Public propertySslFlags
Sets the SSl Flag for the website
Public propertyUseKernelMode
Sets whether Windows authentication is done in kernel mode. Default is true.
Public propertyVirtualDirectories
ITaskItem of VirtualDirectories. Use PhysicalPath metadata to specify applicable values
Public propertyWindowsAuthentication
Sets WindowsAuthentication for the website. Default is false;
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)"/>
    <ItemGroup>
        <Application Include="/photos">
            <PhysicalPath>C:\photos</PhysicalPath>
            <AppPool>NewAppPool100</AppPool>
            <WindowsAuthentication>true</WindowsAuthentication>
            <AnonymousAuthentication>false</AnonymousAuthentication>
        </Application>
        <Application Include="/photos2">
            <PhysicalPath>C:\photos2</PhysicalPath>
        </Application>
        <VirtualDirectory Include="/photosToo">
            <ApplicationPath>/photos2</ApplicationPath>
            <PhysicalPath>C:\photos2</PhysicalPath>
        </VirtualDirectory>
        <HttpResponseHeaders Include="DemoHeader">
            <Value>DemoHeaderValue</Value>
        </HttpResponseHeaders>
        <MimeTypes Include=".test">
            <Value>test/test1</Value>
        </MimeTypes>
    </ItemGroup>
    <Target Name="Default">
        <!-- Create a site with a virtual directory -->
        <MSBuild.ExtensionPack.Web.Iis7Website TaskAction="Create" Name="NewSite" Path="c:\demo" Port="86" Force="true" Applications="@(Application)" VirtualDirectories="@(VirtualDirectory)">
            <Output TaskParameter="SiteId" PropertyName="NewSiteId"/>
        </MSBuild.ExtensionPack.Web.Iis7Website>
        <Message Text="NewSite SiteId: $(NewSiteId)"/>
        <!-- GetInfo -->
        <MSBuild.ExtensionPack.Web.Iis7Website TaskAction="GetInfo" Name="NewSite">
            <Output TaskParameter="SiteInfo" ItemName="SiteInfo"/>
        </MSBuild.ExtensionPack.Web.Iis7Website>
        <Message Text="Id: %(SiteInfo.Id)"/>
        <Message Text="ApplicationPoolName: %(SiteInfo.ApplicationPoolName)"/>
        <!-- Add HTTP Response Headers -->
        <MSBuild.ExtensionPack.Web.Iis7Website TaskAction="AddResponseHeaders" Name="NewSite" HttpResponseHeaders="@(HttpResponseHeaders)"/>
        <!-- Add Mime Types -->
        <MSBuild.ExtensionPack.Web.Iis7Website TaskAction="AddMimeType" Name="NewSite" MimeTypes="@(MimeTypes)"/>
        <!-- Check whether the virtual directory exists -->
        <MSBuild.ExtensionPack.Web.Iis7Website TaskAction="CheckVirtualDirectoryExists" Name="NewSite" VirtualDirectories="@(VirtualDirectory)">
            <Output TaskParameter="Exists" PropertyName="VDirExists"/>
        </MSBuild.ExtensionPack.Web.Iis7Website>
        <Message Text="VDirExists Exists: $(VDirExists)"/>
        <!-- Start a site -->
        <MSBuild.ExtensionPack.Web.Iis7Website TaskAction="Start" Name="NewSite2"/>
        <!-- Check if the site exists -->
        <MSBuild.ExtensionPack.Web.Iis7Website TaskAction="CheckExists" Name="NewSite2">
            <Output TaskParameter="Exists" PropertyName="SiteExists"/>
        </MSBuild.ExtensionPack.Web.Iis7Website>
        <Message Text="NewSite2 SiteExists: $(SiteExists)"/>
        <!-- Create a basic site -->
        <MSBuild.ExtensionPack.Web.Iis7Website TaskAction="Create" Name="NewSite2" Path="c:\demo2" Port="84" Force="true">
            <Output TaskParameter="SiteId" PropertyName="NewSiteId2"/>
        </MSBuild.ExtensionPack.Web.Iis7Website>
        <Message Text="NewSite2 SiteId: $(NewSiteId2)"/>
        <MSBuild.ExtensionPack.Web.Iis7Website TaskAction="CheckExists" Name="NewSite2">
            <Output TaskParameter="Exists" PropertyName="SiteExists"/>
        </MSBuild.ExtensionPack.Web.Iis7Website>
        <Message Text="NewSite2 SiteExists: $(SiteExists)"/>
        <!-- Stop a site -->
        <MSBuild.ExtensionPack.Web.Iis7Website TaskAction="Stop" Name="NewSite2"/>
        <!-- Start a site -->
        <MSBuild.ExtensionPack.Web.Iis7Website TaskAction="Start" Name="NewSite2"/>
        <!-- Delete a site -->
        <MSBuild.ExtensionPack.Web.Iis7Website TaskAction="Delete" Name="NewSite2"/>
        <!-- Set Windows Authentication Providers -->
        <MSBuild.ExtensionPack.Web.Iis7Website TaskAction="SetWindowsAuthenticationProviders" Name="NewSite" Providers="Negotiate" UseKernelMode="False"/>
    </Target>
</Project>
See Also

Reference