Description

This recipe provides the configuration for deploy a website to the Build Server IIS after completed a Build.

Software Requisites

Install Visual Studio 2005 Web Deployment Projects on Build Server

Download: http://msdn2.microsoft.com/en-us/asp.net/aa336619.aspx

Or

Install Visual Studio 2008 Web Deployment Projects on Build Server

Download: http://www.microsoft.com/downloads/details.aspx?FamilyID=0aa30ae8-c73b-4bdd-bb1b-fe697256c459&DisplayLang=en



UnZip PSTools on Build Server at "c:\PSTools"

Download: http://technet.microsoft.com/en-us/sysinternals/bb896649.aspx


Other Requisites

Shared Folder on the Target Server

Example: \\TargetServer\BuildDeploy\



Administrator Rights for the Build Server Account on the Target Server


Preparation

1.- Add a Web Deployment Project to your Web Site.

Reference: http://weblogs.asp.net/scottgu/archive/2005/11/06/429723.aspx



2.- Add a Web Setup Proyect.

Configure in the File System Editor, Add a new "Project Output" under the folder "Web Applicator Folder" and select as project the "Web Deployment Project" created before.



3.- Create a new Build Type and make sure that run under "Release|Mixed Platforms".



4.- In the "Configuration Manager" window, create a new configuration named "Deploy".

Select all the Projects for Build including the Web Deploy Project and the Web Setup Projects.



5.- Run the Build Type.

At this point the build should succeed with no problems.


Usage

Open the "TFSBuild.proj" of the Build Type and add the script at the bottom of the file, before the "</Project>" tag.


Script

<!-- Add a new Target named "AfterCompile" or override if exist -->
<Target Name="AfterCompile">

    <!-- Call devenv to compile the "Web Setup Project" because Team Build doesent support "Setup Project Types" -->
    <Exec Command="&quot;$(VSINSTALLDIR)\Common7\IDE\devenv&quot; &quot;$(SolutionRoot)\Application\Application.sln&quot; /build &quot;Deploy|Mixed Platforms&quot;" />

    <!-- Copy the MSI File to the Output Directory -->
    <Copy SourceFiles="$(SolutionRoot)\Application\WebSetupProject\Deploy\WebSetupProject.msi" DestinationFolder="$(OutDir)" />

    <!-- Copy the MSI File from the Output Directory to the Shared Folder on the Target Server -->
    <Copy SourceFiles="$(OutDir)\WebSetupProject.msi" DestinationFolder="\\TargetServer\BuildDeploy\" />

    <!-- Uninstall a previous version of the "Web Setup Project" -->
    <!-- Add the parameter IgnoreExitCode and ContinueOnError, to avoid the build failure if the Target Server doesent have a version installed -->
    <!-- Under "SETUP-PRODUCT-CODE" you have to add your "Web Setup Project" Product Code. Example: {94078030-4499-41FD-9015-E057EB103DF9} -->
    <Exec Command="&quot;c:\PSTools\psexec&quot; \\TargetServer /accepteula MSIExec /x &quot;SETUP-PRODUCT-CODE&quot; /qn" IgnoreExitCode="true" ContinueOnError="true" />

    <!-- Install the new version of the "Web Setup Project" -->
    <Exec Command="&quot;c:\PSTools\psexec&quot; \\TargetServer /accepteula MSIExec /i &quot;\\TargetServer\BuildDeploy\WebSetupProject.msi&quot; /qn" />

</Target>



Source

This build recipe was made by Juan José Karam - http://www.thesharpcode.com.


Notes

If you have any problem or questions about this Build Recipe you can post me a comment at http://www.thesharpcode.com.


Disclaimer

This build recipe is provided "AS IS" without warranty of any kind.


Last edited Nov 2, 2010 at 6:12 PM by wbarthol, version 2

Comments

No comments yet.