SharePoint WebPart Project templates for Visual Studio 2008

One of the tricky bits with developing WebParts using Visual Studio 2005 is the deployment aspects. 

As mentioned in this article, you firstly have to create a strong-name key, and compile the DLL, load the assembly into the GAC, and include as a SafeControl.

There are STSADM scripts that can be used to do the same thing – the project I’m currently working on has a installfeature script for each WebPart.

With the release of Visual Studio 2008, there are some new project templates available on codeplex.

The SmartTemplates for SharePoint project delivers a collection of Visual Studio templates which allow developers to create a range of SharePoint customizations in a painless and professional fashion.

The SharePoint Web Part project template for Visual Studio allows developers to create quickly a project which contains the base infrastructure to:

  • write the web part code
  • generate a SharePoint Solution file (WSP) for easy deployment
  • generate a setup package for a wizard driven installation

You simply create a new project as a SharePoint WebPart (Smart Template), and build the functionality and layout as normal.


When you compile the DLL, there is a post-build step that runs a batch command (createwsp.bat).

This uses the WSPBuilder console application also available on codeplex.

The WSPbuilder is a console application that creates SharePoint Solutions files based on a folder structure.

WSPBuilder will automatically traverse a “12” folder structure and create the SharePoint solution manifest.xml and the wsp file based on the files it finds.

Therefore knowledge of how to create a solution manifest.xml and wsp file is not needed any more.

The result of the “build” step within Visual Studio is that a SETUP.EXE file is created.  You simply jump out to Windows Explorer – and run the SETUP.EXE !

The wizard even checks to see you have adequate permissions & system requirements in place.


You can then choose which Web Application to “add to SafeControls” :


It registers the DLL in the GAC, adds the feature (installfeature) and activates the feature (WSP) for each chosen Web Application.

When the wizard completes, just have to flip back to SharePoint to turn it on for each particular Site Collection :

  • Site Settings > Site Collection features > Activate

The WebPart will then be available from the WebPart gallery, and can be added to a page.

This is a great time-saver – making deployment of WebParts much easier.

Only problem is – it’s for Visual Studio 2008 – don’t know if that means you have to use .NET 3.5 – or can continue to development WebParts with .NET 2.0 (target framework option within VS 2008).

Click here for more details, and download link.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

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

Google photo

You are commenting using your Google 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 )

Connecting to %s