RaSor’s Blog

October 12, 2008

WSS: Development – Quick Start with WSPBuilder

Filed under: Sharepoint — rasor @ 7:20 pm

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?

4 Comments »

  1. [...] The project is made without WSPBuilder. With WSPBuilder you get a template as a starting point and deployment facilities are included in the project menu. See this article. [...]

    Pingback by WSS Dev: A simple feature - Type Custom Action « RaSor’s Blog — October 15, 2008 @ 10:26 am

  2. [...] From WSPBuilder make your Webpart (WP). See here. [...]

    Pingback by WSS: HowTo debug a WebPart « RaSor’s Blog — October 24, 2008 @ 7:29 pm

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

    Pingback by WSS Dev: WSPBuilder Templates « RaSor’s Blog — October 25, 2008 @ 5:49 pm

  4. [...] WSS: Development – Quick Start with WSPB [...]

    Pingback by BarCampCph Nov 2008 Presentation « RaSor’s Blog — November 22, 2008 @ 2:43 pm


RSS feed for comments on this post. TrackBack URI

Leave a comment

You must be logged in to post a comment.

Blog at WordPress.com.