
harePoint Solution Package files are Microsoft's "preferred choice" for deploying Windows SharePoint Server (WSS) components. A Solution Package is a single compressed Windows Solution Package (
.wsp) file containing all the necessary resources. A
.wsp file can contain one or more WSS components. This article explores how to create and deploy SharePoint Solution Packages to your SharePoint server.
Why Deploy Solution Files?
You should not simply copy files to deploy your SharePoint application to a web farm with multiple servers. Instead, by deploying solution files in lieu of manually copying them, you can avoid errors that might otherwise occur if you were to attempt to uninstall the solution manually. Furthermore, it's cumbersome to have to alter your
web.config files manually, and deploy custom dynamic linked libraries to the GAC, and to each and every
bin folder on multiple servers—just to deploy a web application. In essence, deploying Solution Packages is both easier and more robust than copying files manually.
Creating and Deploying SharePoint Solution Files
Here's a step-by-step approach to creating and deploying a SharePoint Solution Package.
 | |
Figure 1. Create a Sample Project: Create a new ASP.NET Web Application project. |
Create a Sample Web Application Project
Open Visual Studio and select File → New → Project from the menu. Select the ASP.NET Web Application template from the list of available templates (see
Figure 1).
Name the new project "DevX," and click OK to create the project.
Create the Folder Structure
Next, you need to create an appropriate folder structure. First, create a folder called
Source under the solution folder. Inside the
Source folder create a sub-folder called
DevXList. Inside the
DevXList folder, create two more folders:
ListTemplates and
Messages (see
Figure 2). You'll use those folders later to hold the manifest and schema files for the application.
 | |
Figure 2. Folder Structure: Here's the folder structure for the sample application as seen in Solution Explorer. |
Create Feature and Manifest Files
You'll create a feature based on the SharePoint discussions list. To do this, create a new file named
feature.xml that will hold the feature information. This file references two other files that you'll also create:
DevXListManifest.xml and
schema.xml. Here's the content for the
feature.xml file:
<?xml version="1.0" encoding="utf-8"?>
<Feature Id="A2F1A88B-5666-44dc-A485-7209D30DDEA8"
Title="DevX Feature"
Description="This is a sample feature containing a list"
Version="1.0.0.0"
Hidden="FALSE"
Scope="Web"
DefaultResourceFile="core"
xmlns="http://schemas.microsoft.com/sharepoint/">
<ElementManifests>
<ElementManifest Location=
"ListTemplates\DevXListManifest.xml" />
<ElementFile Location="Messages\schema.xml"/>
</ElementManifests>
</Feature>
Next, create a
DevXListManifest.xml file with the following content:
<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<ListTemplate
Name="Messages"
 | |
Figure 3. Sample Application Structure: Here's how the sample application should look after you've created the DevXListManifest.xml and schema.xml files. |
Type="108"
BaseType="0"
OnQuickLaunch="FALSE"
FolderCreation="FALSE"
SecurityBits="12"
Sequence="999"
DisplayName="DevX List"
Description="This is a sample list"/>
</Elements>
To create the
schema.xml file, copy the existing
schema.xml file from the following location:
C:\Program Files\Common Files\
MicrosoftShared\webserverextensions\12\TEMPLATE\FEATURES\
DiscussionsList\Discuss
Paste the file into the
DevX\Source\DevXList\Messages folder that you created earlier. In Solution Explorer, your project should now look like
Figure 3, with the
feature.xml file in the
DevXList folder, the
DevXListManifest.xml file in the
ListTemplates folder and the
schema.xml file in the
Messages folder.