Deploying Web Parts

Importing a web part to a page installs the part in the web part page gallery—the web parts in that gallery are only available on that one page. That's usually what you want during development, since the web part isn't ready for general use. Once you

Error loading the web part

Figure 8-3. Error loading the web part

Error identifying the web part

Figure 8-4. Error identifying the web part

move on to general testing and final deployment, you'll want to install the web part in one of the other galleries. Figure 8-5 shows the available web part galleries and explains the scope of each. The most common way to deploy web parts is to install them in the virtual server gallery. That makes the web part library available to all sites on the virtual server.

Installing web parts in different galleries controls their scope

Figure 8-5. Installing web parts in different galleries controls their scope

Deploying to the Virtual Server Gallery

To install a web part in the virtual server gallery, package the assembly, manifest, and description files as a CAB file and use the SharePoint Administration utility (stsadm.exe) to install the package. To make it easier to use stsadm.exe, add the following lines to the vsvars32.bat file you copied to the \WebParts folder earlier:

 @set STSBinDir=C:\Program Files\Common ...

Get Essential SharePoint now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.