A.7. Using VSeWSS to Build Web Parts

The VSeWSS Web Part Wizard enables you to quickly create SharePoint Web Parts that can inherit from the SharePoint WebPart base class or the ASP.NET 2.0 WebPart base class. It also offers quick deployment of Web Parts using a SharePoint feature manifest built into the embedded SharePoint Solution deployment.

There are several major tasks that are automated by using the SharePoint WebPart template:

  1. Conventional reference establishment and base class inheritance.

  2. Auto-packaging Web Parts into SharePoint solution files for deployment ease (easily the most useful feature).

  3. Temporary key provisioning to sign assembly with a strong name (Temporary.snk), for Web Part deployment into the Global Assembly Cache (GAC) if Code Access Security (CAS) isn't a large concern. This key should be replaced by the enterprise key, which is password protected once the Web Part is pushed to production.

  4. A generic render method to output embedded (child) HTML using HtmlTextWriter, since it allows a granular level of the child control output.

There are very specific references established for some very concrete purposes by using the WebPart project template. The first and most obvious are the SharePoint specific references, since they are required to work with the SharePoint object model. For example, there will be references made to the Microsoft.SharePoint DLL because Web Parts may need site objects (SPSite), web objects (SPWeb), and user (SPUser) objects. Microsoft.SharePoint.Webcontrols ...

Get Professional SharePoint® 2007 Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.