Sunday, November 23, 2008

How to Deploy SharePoint WebParts

There are several ways to skin the Webparts deployment cat, each with a few pluses and minuses.

Method 1 - manual

  • Copy assembly DLL to either
    - /bin directory for a given IIS virtual server (e.g., c:\inetpub\wwwroot\bin)
    - Global Assembly Cache (e.g., c:\windows\assembly)

  • Copy DWP file to C:\Inetpub\wwwroot\wpcatalog

  • Copy resources to
    - For GAC-registered parts, C:\Program Files\Common Files\Microsoft Shared\web server extensions\wpresources
    - For Web Parts in the /bin directory, C:\Inetpub\wwwroot\wpresources

  • Adjust web.config
    - Register as SafeControl
    - Select Code Access Security settings


Method 2: CAB File

  • CAB file should contain
    -Assembly DLL
    -DWP file(s)
    -Manifest.XML
    -Resource files (if needed)
  • CAB won't contain
    - Code Access Security settings

  • Server-side object model has methods for deploying such a CAB file

  • Deploy with STSADM.EXE
    Located in C:\Program Files\Common Files\Microsoft Shared\web server extensions0\BIN
    Add it to your path
    Stsadm -o addwppack -filename filename [-globalinstall] [-force]