WSS: Development – Quick Start with WSPBuilder

So how to get started quick and easy with development of WSS features?

It is not that bad after all. You can

  1. Use WSPBuilder as a starting point
  2. Use an already build WSPBuilder feature as a starting point

For debugging a WebPart see here.

Before you continue you need to install WSPBuilder.

1. WSPBuilder start

  1. Visual Studio – New Project – WSPBuilder Project

    => This gives you a WSS solution container for adding one or more features to.
  2. Add New Item – (choose a WSPBuilder item – ie: Web Part Feature – you could name it MyWebpartFeature)

    Now select scope:

    => This gives you the \12\TEMPLATE\FEATURES\<MyWebpartFeature>\feature.xml and a
    \12\WebPartCode\<MyWebpartFeature>.cs file for adding the code in.
  3. Add your code.
  4. Continue with step 1 in 3. Deploy without setup.exe

2. Copy – Paste start

If you start off from a feature build with WSPBuilder then you only need a few steps:

  1. Copy-Paste the source project.
  2. Rename the target project name. Search-Replace the target project name.
  3. Search-Replace the target namespace. Also replace the default namespace in the project properties.
  4. Change file and directory names: If the project contains webparts:
    The directory \12\TEMPLATE\FEATURES\<MyWebpartFeature>
    and the file \12\WebPartCode\<MyWebpartFeature>.cs also needs to be renamed.
  5. Continue with step 1 in 3. Deploy without setup.exe

3. Deploy without setup.exe

  1. Visual Studio – RightClick feature project – Build (= Shift F6)
  2. Visual Studio – RightClick feature project – WSPBuilder – Build WSP

    => This creates a .cab file called .wsp
  3. Visual Studio – RightClick feature project – WSPBuilder – Deploy
  4. Site (collection) – Site Actions – Site Settings – Site (Collection) features – Activate
  5. Use the feature ie. add the web Part to a page and modify its properties

4. Deploying changes without setup.exe

Following deployment of already deployed feature. This is when you want to test a change of your feature:

  • Visual Studio – RightClick feature project – Build (= Shift F6)
  • Visual Studio – RightClick feature project – WSPBuilder – Copy2Gac (Or do IISReset and Copy)
  • Refresh (= F5) the .aspx under test

5. Deploy with setup.exe

When you need to deploy to another server:

  1. Add New Item – WSPBuilder\Solution Installer Configuration
    => This gives you the \12\Deploy\Setup.exe.config
  2. Edit Setup.exe.config: remove line containing key=”FarmFeatureId”
  3. Optional: Edit \Deploy\EULA.rtf
  4. Visual Studio – RightClick feature project – Build (= Shift F6)
  5. Visual Studio – RightClick feature project – WSPBuilder – Build WSP
    => This creates a .cab file called .wsp
  6. Visual Studio – RightClick feature project – WSPBuilder – Create Deployment folder
  7. Execute \%projectfolder%\bin\deploy\%projectname%\setup.exe on the target server
  8. Site (collection) – Site Actions – Site Settings – Site (Collection) features – Activate
  9. Use the feature ie. add the web Part to a page and modify its properties

6. Uninstall a feature

If you have deployed a web part feature that you need to get rid of do:

  • Site (collection) – Site Actions – Site settings – Web Part Gallery – delete web part
  • Optional: Windows – Assembly – Uninstall (or use GacUtil)
  • Visual Studio – RightClick feature project – WSPBuilder – Uninstall (Or use STSADM)

7. Tips

  • Don’t change version number of your project, since this is referenced from many files in the project. If needed then do a search and replace for it.

 Thanx to Erik Norström for introducing me to WSPBuilder – How can you live without it?

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: