Initially when I first created a webpart for Sharepoint/WSS, I was kind of confused with the number of development and deployment options and kept on wondering for a while for the way to go. You can and should develop the webpart using Visual Studio but you have option to derive from Sharepoint webpart class or from .NET Webpart Class. You can deploy the webpart as a feature or you can deploy it using CAB file. Then you have .DWP and .Webpart files.
Sometime I even saw the message that not able to deploy the webpart since it doesn’t derive from Sharepoint Webpart class. I wondered, why is it that I am forced to derive from Sharepoint Webpart class when I don’t want to use any of the capabilities like inter-webpart communication etc etc.
I thought it would be helpful to jolt down some of my findings and post it here.
I already posted the comparison between deriving from Sharepoint Webpart class and .NET Webpart class. You can see it here
Now you have atleast 2 means to deploy the webpart…
1. Deployment using CAB files
2. Feature based deployment of a webpart
Deployment using CAB file, further vary a little when you are deriving from sharepoint webpart class or .net webpart class.
CAB based Deployment when deriving from Sharepoint Webpart Class
When you derive from Sharepoint Class, you should deploy create a DWP file like
Save this file as <WebPartName>.dwp
One CAB project can be used to deploy one or more webparts. To guide the CAB project, you need manifest (With Name Manifest.xml) file. You create
Then, create a Manifest file, which guides the setup project about all dwp files, safe control entries and embedded resources etc etc..
Your manifest.xml may be something like..
Now you create a CAB project in Visual Studio and add Project Output of Webpart project to the CAB project. With that Manifest.xml will automatically be added. Next add DWP file and other resources as contents to CAB project.
CAB based Deployment when deriving from .NET Webpart Class
Here the process essentially remains the same, only the file content changes a little.
You create .Webpart file instead of .DWP and manifest changes a little.
Create a new file and name it as <WebpartName>.webpart. The content of file is as follows.
Create a new file manifest.xml with content as follows..
The creation of CAB project is essentially the same.
For both of these cases, you can deploy the webpart using following STSADM Commands.
Feature based Webpart Deployment
Here is a link to excellent post that steps to deploy webpart as a feature. Also you should see How Solution deployment has changed development with Sharepoint Technologies.