The following example demonstrates creation of application pool and website using this AppPool on IIS. Normally this would need to be done manually. Thanks to SDC we can automate the whole process to eliminate possible errors that can occure during manual deployment.
<!-- Use SDC tasks -->Using this library you can also create ActiveDirectory user, virtual directories and a whole lot more!
<UsingTask AssemblyFile="Microsoft.Sdc.Tasks.dll" />
<!-- Define website folder -->
<PropertyGroup>
<WebSiteDestDir>
C:\Inetpub\wwwroot_mywebsite
</WebSiteDestDir>
</PropertyGroup>
<!-- Main task -->
<Target Name="Deploy_Webapp">
<CallTarget Targets="CleanIIS" />
<CallTarget Targets="CreateWebSite" />
<CallTarget Targets="CopyContent" />
</Target>
<!-- Clean IIS: remove existing AppPool and Website -->
<Target Name="CleanIIS">
<Web.WebSite.Delete Description="myWebapp" />
<Web.AppPool.Delete AppPoolName="myAppPool" />
</Target>
<!-- Create application pool -->
<Target Name="CreateAppPool" >
<Message Text="Creating my AppPool" />
<Web.AppPool.Create AppPoolName="myAppPool"
WorkerProcesses="1"
IdentityType="NetworkService"
ContinueOnError="false"/>
</Target>
<!-- Create website -->
<Target Name="CreateWebSite" DependsOnTargets="CreateAppPool">
<Message Text="Creating WebSite" />
<Web.WebSite.Create Description="myWebapp"
Path="$(WebSiteDestDir)"
HostName="myWebapp"
AppPoolId="myAppPool"
ContinueOnError="false" />
</Target>
<Target Name="CopyContent" DependsOnTargets="CreateWebSite">
<!-- Copy the app content to WebSiteDestDir here -->
</Target>
3 comments:
Web.WebSite.Delete should be Web.WebSite.DeleteWebSite
Instead of the Using clause, you should have
<Import Project="$(Tools)\Microsoft.Sdc.Common.tasks"/>
can we create IIS wibsite in aremote machine, if so what are all we have to consider. like user credentials....please provide code sample..
SDC Web.AppPool.Delete and Web.AppPool.AppPoolDelete do not work.
I had to go download MSBuild Extension Pack and use:
which does work.
Post a Comment