Archive for January, 2009

Problems with VSeWSS

January 28, 2009 20 comments

I can’t really recommend VSeWSS at all.  

I’ve now lost some considerable time in trying to package up a project for deployment with this tool.   It’ll work one moment and fail the next; adding it to version control or even checking in the project seems to be enough to irretrievably break the build.

Symptoms include constantly encountering this error:

Unable to load one or more of the requested types.
Retrieve the LoaderExceptions property for more information.

I’m using the CTP release of VSeWSS 1.3 for Visual Studio 2008 although the error was also evident using version 1.2.

Update: I’ve found that adding the referenced assemblies to the GAC, resetting IIS then Clean the project in Visual Studio fixes this issue.
I can’t reclaim the hours lost but perhaps this information will help someone else.


Problems with Feature Receivers

January 27, 2009 6 comments

Using VSeWSS to deploy a Feature with a receiver class associated with it, you may encounter the following error when SharePoint attempts to instantiate your class:

Failed to create feature receiver object from assembly "<Assembly>, Version=, Culture=neutral, PublicKeyToken=<Public Key Token>", type "<Namespace>.<Class>" for feature <Feature Guid>: System.ArgumentNullException: Value cannot be null.
Parameter name: type
   at System.Activator.CreateInstance(Type type, Boolean nonPublic)
   at System.Activator.CreateInstance(Type type)
   at Microsoft.SharePoint.Administration.SPFeatureDefinition.get_ReceiverObject()

The obvious things to check are that the class, namespace and assembly references are correct in your feature definition:

    ReceiverAssembly="<Assembly>, Version=, Culture=neutral, PublicKeyToken=<Public Key Token>" >

Less obvious is the fact that the default key for your assembly generated by VSeWSS may be causing the problem.  Generate a new signing key for the assembly and retry deploying your feature; if nothing else works, this just might.

Custom Web Part Pages in WSS (Part 2)

January 21, 2009 2 comments

Following on from Part 1, we will create a custom content type for a Web Part Page for use in a Pages library that supports versioning and is able to be crawled by WSS Search…

Creating a new Site Column

The page body for the custom web part page is to come from a new custom site column, imaginatively called Page Body.  This should be configured to be of type Multiple lines of text and allow Enhanced rich text as shown below:

Create a new Site Column called Page Body

Note: the Allow unlimited length in document libraries option must be set to Yes.

Creating a new Content Type

The next step is to create a new Custom Web Page content type to be used for the custom web part page; this content type will allow for the page’s content to be stored within the page rather than in a web part:


Create a new Document Library

Add a new Document Library to the WSS site; use Web Part Page as the document template and ensure that versioning is switched on:  


Once this has been created, update the document library settings to use content types via the Advanced settings page.  

Then add the Custom Web Page content type to the library:


On the document library settings page,  click on the link for the Custom Web Page content type to open the List Content Type configuration page.   Add the Page Body site column using the Add from existing site of list columns link:


Finally, remove the default Document content type from the list of content types for the library.

As this point the document library settings should look like this:


Update the WSS Web Part Page templates

The final step to complete is to update the WSS Web Part Page templates to make use of the new Page Body column and display the content.  

To do this, simply add the following code to the template in the location you want the content to be displayed, e.g. within the content area with ContentPlaceHolderId=”PlaceHolderMain”:

  <td class="ms-pagebody" colspan="3" valign="top" width="100%">
    <SharePoint:ListItemProperty Property="Page_x0020_Body" runat="server"/>

Of course nothing is ever *that* simple.

WSS ships with eight Web Part Page templates located in the C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\1033\STS\DOCTEMP\SMARTPGS folder.  These files, named spstd1.aspx through spstd8.aspx cannot be renamed as they are used by the spcf.aspx page which serves as the document template for Web Part Pages.

Note: if you edit these templates you will be editing them for all Web Part Pages on that server, so bear this in mind.

Alternatively, create a new page template and associate it with the Custom Web Page content type created earlier.  This is done by specifying a new document template to replace spcf.aspx: open the content type definition for Custom Web Page, select Advanced Settings and then enter the location of the new document template:

Apply Custom Document Template

The new document template must replicate the features of spcf.aspx, i.e. create a new instance of the page template.  

In WSS 3.0, the functionality for this has been moved from embedded code in the aspx page to the owssvr.dll assembly.  Unfortunately this assembly expects the page templates to be named spstd1.aspx through spstd8.aspx.  So you’re left with editing the default pages or attempting to replicate the entire functionality yourself.  

Apparently it is possible to make use of a file written for WSS 2.0 to do this.  Instructions are to be found on MSDN here.  Ignore references to editing create.aspx; we’ve already associated the custom document template with the content type.  Just follow instructions 1 through 6 in the Adding a new Template section.

Using the Custom Web Part Page

Use the Create buttom on the document library task bar as normal.  Select the Web Part Page layout from the standard eight available with WSS.  

To add HTML content to the page, use the context menu for the page to select Edit Properties …


…and then enter content into the Page Body field:

Edit the Page Body field to enter HTML content

The Page Body field will be rendered as HTML on the page:

New Custom Web Part Page

Any HTML content added to the Page Body field will be versioned…


…and crawled for searching via the standard WSS Search.

Install and Configure Telerik RadEditor for MOSS Lite Edition

Whilst not necessary to provide versioned and searchable pages, the RadEditor is recommended as a superior HTML editor.  If deployed, ensure that the RadEditor feature is enabled for list items:


The Lite Edition of the RadEditor for MOSS can be downloaded free of charge from Telerik.