Tuesday, March 31, 2009

Two Approaches for Deploying SharePoint Solutions

I've come across two approaches for deploying SharePoint Solution Packages. There are of course other ways of doing this, including a cafeteria-style combination of both of these. Also, I haven't covered deploying Features as Solution Packages using Visual Studio 2005 here.

To give some background and perspective the following figure depicts the three steps in the SharePoint Solution deployment process...


  1. First the Solution is added to the Solution Store.
  2. Next the Solution is deployed from the Solution Store to the Content Sites (these can be Site Collections or Sites).
  3. Finally, if it was deployed as a Feature (a recommended Best Practice) the Solution must be activated at the Site Collection or Site it was deployed to.

Below are the two approaches I've seen and used. I've only used the GUI approach in Visual Studio 2008…

  • Command line. This approach can be used universally (regardless of whether the Solution was written in VS 2005 or 2008). However it is manual and generally more prone to user error. You also cannot create a script to complete this process using GUI tools the way you can using the command line. Some samples of stsadm.exe usage are here.
    • Add solution: From a command prompt navigate to the directory location of stsadm.exe (C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN\) and enter the following command. If you are not deploying a Feature you can use the file path and file name of the .dll instead. TechNet reference.

      stsadm –o addsolution –filename [Path & filename of wsp]

    • Deploy solution: From the same file path use the following to deploy the Feature to the Farm. TechNet reference.

      stsadm –o deploysolution –name [filename of wsp] -immediate

    • Activate solution: This is only necessary if you are deploying a Feature. If you are deploying a .dll you should not perform this step. TechNet reference.

      stsadm –o activatefeature –name [name of Feature Directory]

  • GUI. This approach uses a combination a combination of Visual Studio 2008, SharePoint CA (Central Administration) and a SharePoint Content Site. As a prerequisite I am assuming you have VSeWSS 1.2 installed (Scot Hillier has an interesting in-depth review of VSeWSS 1.2 here).

    • Add solution: In Visual Studio build the Solution binary by right-clicking the Solution in the Solution Explorer window and selecting Build Solution. If the build is successful repeat the same process but this time select Deploy Solution.

    • Deploy solution: In SharePoint CA, on the Operations tab under Global Configuration select "Solution management". Locate your Solution (.wsp) in the list of Solutions in the Solution Store and click it. On the Solution Properties page click "Deploy Solution".

    • Activate solution: If the Solution was not deployed as a Feature this step is unnecessary. If the Solution was deployed as a Feature it will be necessary to activate the solution. At the Site Collection level this can be done by doing the following. Navigate to the Site Collection TLS (top-level site). In the upper right corner select Site Actions > Site Settings > Modify All Site Settings. Under the Site Collection Administration column (to the right) select the "Site collection features" link. On the Site Collection Features page locate your Solution/Feature and click the Activate button.

3 comments:

Anonymous said...

Of course, what a great site and informative posts, I will add backlink - bookmark this site? Regards, Reader.

Anonymous said...

You have to express more your opinion to attract more readers, because just a video or plain text without any personal approach is not that valuable. But it is just form my point of view

Eric Fang said...

I believe we can also deploy it through powershell cmdlet and server object model