What is the right way to create a website using the MSBuild Extension Pack ?
I am trying to use the MSBuild Extension Pack to build a website using the following goal. Unfortunately, I do not have the correct syntax. This target will throw an exception: "InvalidOperationException: The specified path already exists. \ R". This is after adding the application.
I tried several different versions of the goal below by changing the WebApplication element or the VirtualDirectory element. If you change the Include attribute for the WebApplication element is something other than "/", then the creation will work. Although after creating the website I can not start it due to COM error 0x800710D8. (The object identifier is not a valid object)
<Target Name="ProvisionIIS7WebSite" DependsOnTargets="CreateDeploymentNumber">
<PropertyGroup>
<WebSiteName>$(BaseDeploymentName)$(DeploymentNumber)</WebSiteName>
<PortNumber>$(DeploymentNumber)</PortNumber>
</PropertyGroup>
<ItemGroup>
<WebApplication Include="/">
<PhysicalPath>$(WebSitePath)</PhysicalPath>
</WebApplication>
<VirtualDirectory Include="/">
<ApplicationPath>/</ApplicationPath>
<PhysicalPath>$(WebSitePath)</PhysicalPath>
</VirtualDirectory>
</ItemGroup>
<MSBuild.ExtensionPack.Web.Iis7Website TaskAction="Create"
Name="$(WebSiteName)"
Port="$(PortNumber)"
Path="$(WebSitePath)"
AppPool="$(WebSiteAppPool)"
Applications="@(WebApplication)"
VirtualDirectories="@(VirtualDirectory)">
<Output TaskParameter="SiteID" PropertyName="WebSiteID" />
</MSBuild.ExtensionPack.Web.Iis7Website>
<Message Text="Created website with ID $(WebSiteID)" />
</Target>
source
share