How do you setup a new web application on an existing web site?

Feb 25, 2010 at 11:34 PM

I have a web site that I have already created that I would like to add a new application to. I have tried several different uses of the IIS7Website’s “AddApplication” action without any success. Here is my last attempt. The CreateWebSite ItemGroup has all of the data used for this call.

  <Target Name="ProvisionIIS7WebSite" DependsOnTargets="$(ProvisionIIS7WebSiteDependsOn)"

          Condition=" '@(CreateWebSite)' != '' " >

    <MSBuild.ExtensionPack.Web.Iis7Website TaskAction="AddApplication"

      Name="Default Web Site"

      Applications="%(CreateWebSite.Name)"

      PhysicalPath="%(CreateWebSite.VirtualRoot)"

      Path="%(CreateWebSite.URL)"

      AppPool="%(CreateWebSite.AppPool)" />

  </Target>

Coordinator
Feb 26, 2010 at 12:52 PM
You need to pass in the website name and the Applications to add as an Item.
e.g.
<YOURAPPLICATION Include="/photos2">
            <PhysicalPath>C:\photos2</PhysicalPath>
</YOURAPPLICATION>

<MSBuild.ExtensionPack.Web.Iis7Website TaskAction="AddApplication" Name="YOURWEBSITE" Applications="@(YOURAPPLICATION)"/>

Mike