Valid TaskActions are:

AddApplication (Required: Name, Applications Optional: Force)

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)

Delete (Required: Name)

DeleteVirtualDirectory (Required: Name, VirtualDirectories)

GetInfo (Required: Name Output: SiteInfo, SiteId)

ModifyPath (Required: Name, Path Output: SiteId)

ModifyLogDirectory (Required: Name, LogDirectory)

Start (Required: Name)

Stop (Required: Name)

Remote Execution Support: Yes

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

Examples

Xml Copy imageCopy
<Project ToolsVersion="3.5" 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>
        </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)"/>
        <!-- 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"/>
    </Target>
</Project>

Inheritance Hierarchy

System..::..Object
  Microsoft.Build.Utilities..::..Task
    MSBuild.ExtensionPack..::..BaseTask
      MSBuild.ExtensionPack.Web..::..Iis7Website

See Also