Showing posts with label SharePoint 2007 Administration. Show all posts
Showing posts with label SharePoint 2007 Administration. Show all posts

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.

SharePoint Administration Toolkit

The Microsoft SharePoint Product Group has released what looks like a useful SharePoint administration toolkit. The functionality is generally targeted to complex farm or multi-farm scenarios.

Friday, March 27, 2009

Adding Assemblies to the GAC

While working with SharePoint I've found the following approaches (choose any one of the following) for adding assemblies to the GAC. A full explanation for all of the gacutil switches can be found in the Microsoft MSDN Library at http://msdn.microsoft.com/en-us/library/ex0ss12c(VS.80).aspx. Note that these are for a single-server farm scenario running Windows Server 2003 R2.
  • If Visual Studio .NET (any version) is installed, Start > All Programs > Microsoft Visual Studio [version] > Visual Studio Tools > Visual Studio [version] Command Prompt. From the command prompt navigate to the folder where the assembly to be added to the GAC resides and enter the following...

gacutil.exe -if "[assembly name]"

  • From a raw Command Prompt navigate to the location of the gacutil.exe program (C:\Program Files\Microsoft SDKs\Silverlight\v2.0\Libraries\Server\) and enter the following...

gacutil.exe -if "[assembly file path & name]"

  • Log onto the SharePoint server as an administrator and using Windows Explorer copy the assembly to be added to the GAC into C:\WINDOWS\assembly. Do this by dragging the assembly from the bin folder of your VS project into the C:\Windows\assembly folder.