Archive

Posts Tagged ‘Visual Studio’

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=1.0.0.0, 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:

<Feature
    Id="<Guid>"
    Title="<Title>"
    ...
    ReceiverClass="<Namespace>.<Class>"
    ReceiverAssembly="<Assembly>, Version=1.0.0.0, 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.

Advertisements

Adding required files to Source Control for VSeWSS projects

May 20, 2008 1 comment

After creating a new project in Visual Studio 2005 using the extensions for WSS 3.0, only part of the project’s required files are visible in Solution Explorer.

You can view all the files used to create the WSP for deployment using the WSP View (Views>Other Windows>WSP View) but that still doesn’t help you when you need to add the files to source control.

Instead, I recommend that using Solution Explorer, you click on the Show All Files button and then add the pkg folder to the Visual Studio project.  This will ensure that the XML files required to deploy your solution are saved to source control along side your actual coded solution.