2

I am working with SharePoint 2010. In my solution I have multiple features and event receivers for each feature, and no web part in the solution. I am not sure how to deal with multiple features in a solution. All was working fine with one feature, but as I add another feature, wsp gets deployed but the new feature does not.

Is there anything specific I need to do with regards to multiple features?

Please help me.

Thanks VB

2 Answers 2

2

If you're working with Visual Studio 2010 make sure that new/old Feature is added in Package.

You can use the Package Designer to create and customize a package (.wsp). For example, you can add SharePoint project items and Features, specify if the Web server is reset when the solution is deployed, and set the deployment server type.

http://msdn.microsoft.com/en-us/library/ee231605.aspx

5
  • Ahh the feature was excluded from package. But I got an error after adding the feature to package.
    – V.B
    Jun 7, 2012 at 13:01
  • Error occurred in deployment step 'Add Solution': Failed to create receiver object from assembly "xxxxxxxxxxxxx.Feature, Version=1.0.0.0, Culture=neutral, PublicKeyToken=54d2cbe44edf3125", class "$SharePoint.Type.423fd1f3-f277-469b-87d6-c7e57f85a754.FullName$" for feature "xxxxxxxxxx.Feature" (ID: 3b5d12ff-d061-425f-8139-7d96404c1b88).: System.ArgumentNullException: Value cannot be null. Parameter name: type at System.Activator.CreateInstance(Type type, Boolean nonPublic) at Microsoft.SharePoint.Administration.SPFeatureDefinition.get_ReceiverObject()
    – V.B
    Jun 7, 2012 at 13:02
  • It seems that SharePoint timer service which handles solution installation caches DLL is still holding the old one. The cached old DLL has no feature receiver. As a result, the error is Failed to create receiver object from assembly for event receiver. Reset IIS and SharePoint timer job and perform deployment again: sharepointconnoisseur.blogspot.se/2011/12/… Jun 7, 2012 at 13:09
  • The error message suggest that you have changed/the guid Attribute for the FeatureReceiver class. If you do that you also have to change the xml file for the feature. Jun 7, 2012 at 17:20
  • I tried to reset IIS and restart the timer service but still no luck.
    – V.B
    Jun 8, 2012 at 5:36
1

You can easily have multiple features in a single solution, and each of those features can have different scopes (ie: web application and site collection features in the same solution). You do need to ensure that if they have dependencies on one another, those dependencies are setup.

Are you "upgrading" the solution, or retracting and redeploying now that you have your new feature structure. In a lot of cases, unless your code has been setup to compare version numbers, an event receiver that wasn't previously activated will not automatically activate as part of an upgrade. You either need to handle the version difference in code, or do a full retract/deploy.

2
  • I am retracting and redeploying the solution but only the first feature comes up in the features list not the other. Scope of both the features is same "web".
    – V.B
    Jun 7, 2012 at 12:40
  • Double check that they're not set to be hidden, and that they all have unique GUIDs (if you copied the existing solution to create the separate ones, you may have copied the GUID also, but I'd expect it to not build if they were the same). If you do Get-SPFeature | Where {$_.Scope -eq "Web"} in PowerShell, do you see all of them, or just the one?
    – webdes03
    Jun 7, 2012 at 12:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.