WSS Dev: WSPBuilder Templates

When you start out building WSS features from WSPBuilder then what is there to choose from?
What is in the WSPBuilder templates

PreRequisite: Install WSPBuilder addon for Visual Studio – Version 2k5 onwards.
Quick Start with WSPBuilder here.

WSPBuilder Project templates

First choose a new project from the WSPBuilder folder. As you can see on the name, then choose the Workflow template if your feature includes Workflows.

Both are normal Class library projects.
The difference is on the Add menu:

  • With Workflow:
  • Without Workflow:

Of files they both contains close to nothing:

There is a key so the assembly will be strong named and there is the top folder for the 12 hive.

WSPBuilder New Items templates

To deploy the code you’ll most often need to put it into a feature. In this case you’ll have to start out with a feature template. Those are:

  1. Blank Feature
  2. Feature with Receiver
  3. Web Part Feature
  4. Sequential Workflow Feature
  5. State Machine Workflow Feature
  6. Event Handler

After choosing a feature template you might also want to add one of the other templates:

  1. Custom Field Type
  2. Item Template
  3. Web Part Without Feature

Then there are feature independent templates:

  1. Web Service

Finally you might want to add:

  1. Solution Installer Config //To create a setup.exe for deploying on a separate server.

The Feature templates

1. Blank Feature

Added is:

– Three folders, where the last uses the name of the feature
Feature.xml
– An empty elements.xml

Todo:

– Add elements to elements.xml like in this post.

2. Feature with Receiver

Added is:

– Three folders, where the last uses the name of the feature
Feature.xml that links to the feature code
– An empty elements.xml.
– A code file with the name of the feature (RcvFeat.cs)

Todo:

– Add activation/deactivation code to the code file.
– Optional add elements to elements.xml like in this post.

3. Web Part Feature

Added is:

– Three folders, where the last uses the name of the feature
Feature.xml
– An elements.xml with a module element that links to a .webpart file
– A .webpart file with the name of the feature that links to the code
– A code file with the name of the feature (WebPartFeat.cs)

Todo:

– Add controls and logic to the code file.

4. Sequential Workflow Feature

Added is:

– Three folders, where the last uses the name of the feature
Feature.xml. This links to a MOSS feature receiver.
– An elements.xml with a workflow element that links to the WF code
– A Workflow designer code file with the name of the feature (SeqWfFeat.cs)
– Workflow designer automatic generated code with the name of the feature (SeqWfFeat.designer.cs)

Todo:

– Add activities to the Workflow.
– Remove the link to the MOSS feature receiver.
– Remove the “using Microsoft.Office.Workflow…” in the code.

5. State Machine Workflow Feature

Same as above.

6. Event Handler Feature

 

The add on templates

11. Custom Field Type

PreRequisite: Add “1. Blank Feature”.

Added is:

– A usercontrol (.ascx) for custom editing of the field
– Code containing the field and validation logic (<fieldtypename>.cs)
– Code containing a visible control in view mode (<fieldtypename>Control.cs)
– Code containing a visible control in edit mode (<fieldtypename>Editor.cs)

Todo:

– Add a sitecolumn (element <Field>) for the fieldtype to the elements.xml
– Optional add a ref from a contenttype (element <ContentType>) for the sitecolumn to the elements.xml
– Add code to fill possible values in control class (<fieldtypename>Control.cs)
– Add validation code in the field class (<fieldtypename>.cs)

12. Item Template

PreRequisite: Add “1. Blank Feature”.

 

13. Web Part Without Feature

PreRequisite: Add “1. Blank Feature”.
For more description see the Web Part Feature template above.

The independant templates

21. Web Service

This is a webservice like any other Web Service. Installed like a application page.
Do whatever you like in the service.

The deployment template

31. Solution Installer Config

See this HowTo.

 

Download the samples (VS2k5).

The End.

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: