8.3. Deploying Web PartsImporting a web part to a page installs the part in the web part page gallerythe 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 animal 8-3. Error loading the web partanimal 8-4. Error identifying the web partmove 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. animal 8-5. Installing web parts in different galleries controls their scope8.3.1. Deploying to the Virtual Server GalleryTo 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 Files\Microsoft Shared\web server extensions\ 60\bin @set PATH=%STSBinDir%;%PATH%; Follow these steps to create and install the package from Visual Studio:
8.3.2. Adding to the Site GalleryOnce the web part library is deployed to the virtual server, you can add those parts to the Team Web Site gallery from within SharePoint. The site gallery allows you to categorize web parts so they can be filtered from the task pane, as shown in Figure 8-7. To add a web part to the Team Web Site gallery:
animal 8-6. Adding output and content to the CAB fileanimal 8-7. Filtering web parts in the site galleryTo add a category for the web part:
animal 8-8. Adding web parts to the site galleryanimal 8-9. Creating a category for a web part8.3.3. Deploying as Windows Installer FilesUsing CAB files is a simple way to deploy web parts. However if you want to include custom permission sets and allow uninstall from the Control Panel, you need to use the Web Part Packager utility ( wppackager.exe ) to create a Windows installer file ( .msi ) for deployment. To use wppackager.exe to create an . msi file for a web part library:
Once you've create the .msi file, you can install the web part library by running that file on the server. The installer walks you through the installation process providing a more friendly user -interface than the stsadm.exe utility. The packaging file tells wppackager.exe what to include in the Windows installer file. For example, the following packaging file includes the web part library created earlier: <?xml version="1.0" ?> <Wppackager xmlns="http://schemas.microsoft.com/WebPart/v1/Wppackager"> <Manifest FileName="Manifest.xml" /> <CodeAccessSecurity AssemblyName="WebPartLibrary1" Version="1.0.0.0" PublicKeyBlob="a451359320dc76e6" > <PermissionSet class="NamedPermissionSet" version="1" > <IPermission class="System.Web.AspNetHostingPermission, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Level="Minimal" /> <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="Execution" /> <IPermission class="Microsoft.SharePoint.Security.WebPartPermission, Microsoft.SharePoint.Security, Version=11.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" version="1" Connections="True" /> <IPermission class="Microsoft.SharePoint.Security.SharePointPermission, Microsoft.SharePoint.Security, Version=11.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" version="1" ObjectModel="True" /> </PermissionSet> </CodeAccessSecurity> <MSI Name="WPSetup1" Version="1.0.0.0" Manufacturer="SP2003 Sample" /> </Wppackager> Table 8-4 describes the elements in packaging files. Table 8-4. Packaging file elements
More information about packaging files and custom permission sets can be found at:
8.3.4. Deploying to the Online GalleryThe online gallery lists web parts deployed through a web service. By default, it is set to the Microsoft Office site through this setting in Web.config : <OnlineLibrary Url="http://r.office.microsoft.com/r/hlidAwsGallery" /> You can change the setting to point to a web service provided within your organization. There is no information on implementing the online gallery web service at this time, but I will post anything I find at http://usingsharepoint.com/Samples/OnlineGallery.aspx. |