Adding a warm-up step to your SharePoint project deploy action

 

VS.NET 2010 allows a lot of awesome control over the exact steps that occurs when you deploy your project to your development environment.

image

Figure: VS.NET 2010 Deploy

 

When you are deploying farm solutions however, it does an IIS Reset, which means when VS.NET says it's done, and you go into your browser to test the site, it sits there for a few minutes warming up.  Sad smile

Fortunately, VS.NET is very extensible, and the community is awesome and has already added many useful extensions.

Grab CKS DEV

To fix this, first grab CKS extensions here: http://cksdev.codeplex.com/

 

SharePoint Project Properties | SharePoint

You can't edit any of the default configurations, so make your own and add the actions you want.

image

CKS provides a deployment step "Warm up SharePoint Site (CKSDev)" which will send a request to warm up the SharePoint site that the project deploys to.  (see #1 below)

image

The problem with the CKSDev warm-up step is that the action doesn't actually wait for the site to tell us it's ready, so VS.NET will say "Done", but when you open the browser, it's still not ready Sad smile

So we add another CKS step "Run PowerShell Script (CKSDev)".  See #2 above.

 

Using a PowerShell step to make sure it is REALLY READY

You then need to look at the properties of the project to see a new property under Deployment. 

Point that to a ps1 file in your project directory.

image

 

The contents of the ps1 file can be very simple, in 3 lines:

 

$WebClient = New-Object System.Net.WebClient
$WebClient.UseDefaultCredentials = $true
$Results = $WebClient.DownloadString("http://colt-sp2010/sites/Home/SitePages/default.aspx")

When you deploy now, it will run until the PowerShell step returns.  Smile

Activate Features:
  Activating feature 'Grid Feature' ...
Run Post-Deployment Command:
  Skipping deployment step because a post-deployment command is not specified.
Warm up SharePoint Site (CKSDev):
Run PowerShell Script (CKSDev):
  --Executing PowerShell Script #1 'D:\Temp\Grid\warmupsite.ps1'...
 
  --Script 'D:\Temp\Grid\warmupsite.ps1' successfully executed
========== Build: 1 succeeded or up-to-date, 0 failed, 0 skipped ==========
========== Deploy: 1 succeeded, 0 failed, 0 skipped ==========

Updating VS.NET 2008 Professional to use TFS 2010

We have some old virtual machines with VS.NET 2008 installed, used to build and maintain packages for WSS3 / MOSS 2007.  Now that we have a nice new TFS 2010 installed, I go about fixing them up and making sure the various projects lying around are properly checked into TFS.

 

Getting an unpatched VS.NET 2008 to talk to TFS 2010 involves:

  1. Installing VS.NET 2008 Team Explorer - this allow VS.NET 2008 to be able to talk to TFS as a source control system.
    http://www.microsoft.com/downloads/en/confirmation.aspx?FamilyID=0ed12659-3d41-4420-bbb0-a46e51bfca86&displaylang=en
  2. Installing VS.NET 2008 Service Pack 1
    http://www.microsoft.com/downloads/en/details.aspx?FamilyID=27673C47-B3B5-4C67-BD99-84E525B5CE61
  3. Installing VS.NET 2008 Forward Compatibility Update for TFS 2010

I fumbled around with the order a bit - was doing #2 before I realized I don't even have team explorer.  After I worked out what needed to be done, the order makes more sense.

Installing TFS 2010 on 2008R2

System Checks: The .NET 3.5 Framework is not installed.  You must install the .NET 3.5 Framework Feature before continuing.

 

I love how TFS 2010 splits the installation from 1 giant step into two relatively simple ones.

  1. Install the components
  2. Configure the TFS server

Installation

Here's the relatively painless installation.

image

 

Configuration

Here's the configuration, which should have been painless, except its not.  TFS needs .NET 3.5 Framework, which hasn't been installed on a clean, new 2008 R2 machine.

image

 

Problem

TFS needs .NET 3.5, but doesn't install it.  It installs .NET 4, then blocks you during configuration wizard.

MS explains it here: http://connect.microsoft.com/VisualStudio/feedback/details/585754/after-install-tfs-2010-requires-net-fw-3-5-fw-4-0-already-installed but I think it's just stupid :-(

 

Correct Fix

First Enable .NET Framework 3.5.1 from Add Features

image

image

Reinstall/Repair TFS.  So .NET 4 is installed AFTER 3.5

Then finally, run TFS Configuration again.

image