Azure DevOps, Scrum, & .NET Software Leadership and Consulting Services

Free course! Predicting the Future, Estimating, and Running Your Projects with Flow Metrics

Updated TFS2012 Build Activities – Now with IIS Reset and Database Deploy!


I updated my Team Foundation Server 2012 Build Activities last week.  If you’re trying to deploy or configure your application during a TFS automated build, you might find these helpful.  When you add these activities to a customized TFS build process template, they’ll help you to do common activities for generating a release candidate and/or deploying your application. 

I’ve added two new activities: one for performing an IIS Reset from the build, and also one for deploying the *.dacpac from a Visual Studio database project to SQL Server.

Activity Description
DeployDatabase Deploys the *.dacpac that is generated by a Visual Studio SQL Server Database Project and deploys it using settings specified in a “Publish Database Profile” file (*.publish.xml) using an incremental update.
IisCreateWebApplication Creates an application in IIS and sets the app pool and security settings (Anonymous, Basic, NTLM) for the application. 

Requires that the build agent process is an administrator on the IIS machine.

IisDeleteWebApplication Deletes a web application from IIS.

Requires that the build agent process is an administrator on the IIS machine.

IisReset Allows you to reset IIS. 

Requires that the build agent process is an administrator on the IIS machine.

MoveFile Move or rename a file.  This is helpful for dealing with environment specific configuration files.  
Sleep Causes execution of the build to wait for specified number of milliseconds.
TouchFIle Modifies the last write time on a file without modifying the contents.  Roughly the equivalent to the unix/linux ‘touch’ command. 
UpdateAspNetSessionState Modifies the session state configuration values in web.config for an ASP.NET application.
UpdateConnectionString Modifies a database connection string in app.config or web.config.

In addition to adding the new IisReset and DeployDatabase activites, I consolidated the activities and their supporting logic into a single assembly and I also refactored the build log messaging to be more consistent and clean. 

Here’s the source code and the binaries.

Enjoy.

-Ben

 

— Want some help developing your automated builds?  Trying to deploy your app with Lab Management and having trouble?  Trying to deploy your app without Lab Management and having trouble?  Want to learn how to create and customize TFS Automated builds and write your own build activities?  Drop us a line at info@benday.com.

SUBSCRIBE TO THE BLOG


4 responses to “Updated TFS2012 Build Activities – Now with IIS Reset and Database Deploy!”

  1. […] Updated TFS2012 Build Activities – Now with IIS Reset and Database Deploy! Slides & code from TFS Builds talk at VSLive Orlando 2012 By Ben Day On December 17, 2012 […]

  2. Damon Hermann Avatar

    Hi.
    First thank you for your site. I have learned so much in a very short time. I am having serious trouble deploying a db in my build script. I’ve been trying to use the MSBuild activity and keep getting SqlPublishTask Parameter PublishProfile is not set. Even though I have set the SqlPublishTask=qa-tds.publish.xml

    I ran across your niffty set of activities and decided to try the DatabaseDeploy.

    Here are my inputs:
    DacPacPath: “\192.168.120.56d$Build SourceTDS v3.0DatabaseTDSTDSbinDebug”

    ProfilePath:

    “\192.168.120.56d$Build SourceTDS v3.0DatabaseTDSTDSTDS-QA.publish.xml”

    I am getting the following error:
    TF215097: An error occurred while initializing a build for build definition Shared ServicesTDS-BDT-Test: Cannot create unknown type ‘{clr-namespace:Benday.TeamBuild2012.Activities;assembly=Benday.TeamBuild2012.Activities}DeployDatabase’.

    I am hoping you can help me out.

    Sincerely,
    Damon Hermann

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.