How to MSDeploy a built website package to a virgin IIS website

I am trying to automate our build/deployment process.

So far I am using:

  • a Visual Studio 2010 solution with a main Web Application project (and dependent projects)
  • MSBuild
  • MSDeploy
  • CruiseControl.Net

So after much wrangling and gnashing of teeth, I now have CCNet kicking off an MSBuild script to build, package and deploy the website. The MSBuild script is below:

<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Target Name="Build"> 
    <MSBuild Projects="$(CCNetWorkingDirectory)\src\Product.sln"
                    Targets="Clean;Rebuild"
                    Properties="Configuration=$(Configuration)"
    />
</Target>

<!--<Target Name="Test" DependsOnTargets="Build">
    <MSBuild Projects="$(CCNetWorkingDirectory)\src\Product.Web.Tests\Product.Web.Tests.csproj"
                    Properties="Configuration=$(Configuration);OutputPath=$(CCNetArtifactDirectory)\Tests\" />
    <Exec Command="$(MSTestPath) /testcontainer:$(CCNetArtifactDirectory)\Tests\Product.Web.Tests.dll /runconfig:$(CCNetWorkingDirectory)\src\Local.testsettings" ContinueOnError="false" />
</Target>-->

<Target Name="Package" DependsOnTargets="Build"> 
    <MSBuild Projects="$(CCNetWorkingDirectory)\src\Product.Web\Product.Web.csproj"
                    Targets="Package"
                    Properties="Configuration=$(Configuration);PackageLocation=$(PackageDir)\Product.zip"
    />
</Target>

<Target Name="Deploy" DependsOnTargets="Package">
    <Exec Command="&quot;$(MSDeployPath)&quot; -source:package='$(PackageDir)\Product.zip' -dest:auto,computerName='$(MSDeployComputerName)',includeAcls='False' -verb:sync -setParamFile:$(PackageDir)\Product.SetParameters.xml" ContinueOnError="false" />
</Target>

This all works fine as long as on the target machine there is already a website configured in IIS. This doesn't need to be an existing "real" site (it could just be a shell).

While this is great, I really want MSDeploy to automatically create the website, as it seems it can do with a web app. Is this possible? And if so any help would be greatly appreciated!

10
задан Pedro 1 October 2010 в 00:02
поделиться