If you want to deploy a web part, you can use SharePoint solution files. Basically, SharePoint solution files are cabinet files (.cab) with a different extension, namely .wsp. When you use Visual Studio 2005 extensions for Windows SharePoint Services 3.0 to create a web part, as was discussed in my prevuois postings, a web part solution file is created automatically for you. In this section, you will learn how to create a SharePoint solution file that allows you to deploy a web part to other SharePoint servers and/or SharePoint web applications.
To demonstrate web part deployment, we will create a new web part called MyWebPart.cs that uses the ASP.NET 2.0 Wizard control to implement a wizard. The Wizard server control enables you to build a sequence of steps that are displayed to the end user. You could use the Wizard control to either display or gather information in small steps. The Wizard control lets you define a group of views in which only one view at a time is active and is rendered to the client. Each view consists of four zones: sidebar, header, content, and navigation. The optional sidebar part contains an overview of all the steps in the wizard. The header contains the header information. The content part contains whichever control or controls you like. The navigation part consists of buttons to
navigate through the steps in the wizard.
When you are constructing a step-by-step process that includes logic for every step taken, use the Wizard control to manage the entire process. The Wizard control’s navigation buttons fire server-side events whenever the user clicks one of the buttons, helping to navigate to other wizard views on the same page. Navigation can be linear and nonlinear; in other words, you can jump from
one view to another or navigate randomly to whichever view you like. All the controls in a wizard view are part of the page, so you can access them in code using their control IDs.
In this example, I have defined six different steps. Each step is a WizardStep control and contains a text box. The state of the text boxes in the wizard is maintained automatically. The order in which the steps are defined is completely based upon the order in which they are added to the wizard via the Add() method of the Wizard object’s WizardSteps property. The WizardSteps property contains a collection of WizardSteps. Changing this order changes the order in which the end user sees them. The following figure shows the first step.

The first step, the start step, always has one button called Next. The following steps will have two buttons, as seen in Figure below:

There are six steps in this example. The final step, step 6, has a Previous and a Finish button, as you can see in Figure below:

The MyWebPart web part creates a very simple wizard; the Wizard control itself has a lot more options that I will not cover in this posting (sometime later!). The code for the web part using the Wizard control is shown in fig below:
using System;
using System.Runtime.InteropServices;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Serialization;
using Microsoft.SharePoint;
using Microsoft.SharePoint.WebControls;
using Microsoft.SharePoint.WebPartPages;
namespace KwikSilver.Sharepoint.WebpartDemo
{
[Guid(“3d82fb59-c294-497d-9d47-d85c21540b06”)]
public class MyWebPart : System.Web.UI.WebControls.WebParts.WebPart
{
public MyWebPart()
{
}
protected override void CreateChildControls()
{
}{
}
protected override void CreateChildControls()
{
Wizard objWizard = new Wizard();
objWizard.HeaderText = “Wizard Header”;
for (int i = 1; i <= 6; i++)
{
WizardStepBase objStep = new WizardStep();
objStep.ID = “Step” + i;
objStep.Title = “Step “ + i;
TextBox objText = new TextBox();
objText.ID = “Text” + i;
objText.Text = “Value for step “ + i;
objStep.Controls.Add(objText);
objWizard.WizardSteps.Add(objStep);
}
Controls.Add(objWizard);
}
}objWizard.HeaderText = “Wizard Header”;
for (int i = 1; i <= 6; i++)
{
WizardStepBase objStep = new WizardStep();
objStep.ID = “Step” + i;
objStep.Title = “Step “ + i;
TextBox objText = new TextBox();
objText.ID = “Text” + i;
objText.Text = “Value for step “ + i;
objStep.Controls.Add(objText);
objWizard.WizardSteps.Add(objStep);
}
Controls.Add(objWizard);
}
Now that we have created a web part, we are ready for the next step, the creation of a SharePoint solution file.
In the first part of the process, we will add a manifest file (Manifest.xml) to our web part library solution. The manifest file is used by Visual Studio 2005 and defines how to populate the cabinet file that is used to deploy the MyWebPart web part. The next procedure explains how to create a Manifest.xml file and how to add IntelliSense support to it:
1. In the WebpartDemo project, choose Add äNew Item. This opens the Add New Item -
WebpartDemodialog box.
2. In the Templates section, choose XML file.
3. In the Name text box, add the following value: Manifest.xml.
4. Click the Add button.
5. Click the Code window of Manifest.xml.
6. In the Properties window, click Schemas.
7. Click the ... button. This opens the XSD Schemas dialog box.
8. Click the Add button. This opens the Open XSD Schema dialog box.
9. Locate wss.xsd ([drive letter]:\Program Files\Common Files\Microsoft Shared\web server
extensions\12\TEMPLATE\XML) and choose Open.
10. Click OK.
11. Add the code shown below to Manifest.xml:
<?xml version=”1.0” encoding=”utf-8” ?>
<Solution xmlns="http://schemas.microsoft.com/sharepoint/"
SolutionId="312ae869-37dc-4a74-9ecc-359fb3c1461d">
<Assemblies>
<Assembly DeploymentTarget=”WebApplication”
Location=”WebpartDemo.dll”>
<SafeControls>
<SafeControl Assembly=”WebpartDemo,
Version=1.0.0.0,
Culture=neutral,
PublicKeyToken=9f4da00116c38ec5”
Namespace=”KwikSilver.Sharepoint.WebpartDemo”
TypeName=”*”
Safe=”True” />
</SafeControls>
</Assembly>
</Assemblies>
</Solution>
After adding the Manifest.xml file to the web part library project, you can go ahead and create a
cabinet project to deploy the MyWebPart web part to another SharePoint server or SharePoint web
application. The next procedure explains how to create a SharePoint solution file:
1. Open the WebpartDemo web part library solution.
2. Choose File Add New Project. This opens the Add New Project dialog box.
3. In the Project types section, expand the Other Project Types node and choose Setup and
Deployment.
4. In the Templates section, choose CAB Project.
5. In the Name text box, add the following value: WebpartDemoCab.
6. Click OK.
7. Right-click WPLibraryCab and choose Add äProject Output. This opens the Add Project
Output Group dialog box.
8. In the Project drop-down list, choose WebpartDemo.
9. Select Primary output and Content Files.
10. Click OK.
11. Build WebpartDemoCab.
12. Locate WebpartDemoCab.cab and rename it to WebpartDemo.wsp.
13. Open a command prompt, and type the following command:
stsadm -o addsolution -filename WebpartDemo.wsp
Now, the SharePoint solution is added to SharePoint. You can deploy it further using the stsadm tool, or deploy the solution via the user interface of the SharePoint 3.0 Central Administration tool. The next procedure explains how to deploy the solution using the SharePoint 3.0 Central Administration tool:
1. Open SharePoint 3.0 Central Administration.
2. Click Operations. This opens the Operations page.
3. In the Global Configuration section, choose Solution Management. This opens the Solution
Management page. This is shown in Figure.

Click the MyWebpartDemoCab.wsp link. This opens the Solution Properties page, which is shown in Figure below:

5. Click Deploy Solution. This opens the Deploy Solution page, as shown in..

6. In the Deploy to ? section, choose a Web application to deploy this solution.
7. Click OK. This opens the Solution Management page that is shown in Figure down below:
.At this point, the SharePoint solution is deployed to a specific SharePoint server and a specific SharePoint web application. Before you are able to use the web parts deployed using a SharePoint solution, you need to add them to the web part gallery of the site collection:
8. Browse to the web application you have chosen in the previous step.
9. Choose Site Actions Site Settings. This opens the Site Settings page.
10. In the Galleries section, click Web Parts. This opens the Web Part Gallery page.
11. Click New. The web parts in the MyWebPartDemo assembly should be listed; select them
and click the Populate Gallery button.
You have seen how to create a SharePoint solution (.wsp) file that can be used to deploy web parts. After completing all the steps described in this section, you are ready to start using the web parts deployed via the SharePoint solution.
Hope this helps a lot!..