I am developing a web part and suddenly receive this error when activating it from site settings.

System.InvalidCastException: Unable to cast object of type 'Microsoft.SharePoint.Administration.SPSolution' to type 'Microsoft.SharePoint.Administration.SPFeatureDefinition'.

I cannot get this cleared up even after retracting and removing a number of times. Thanks

  • 1
    are you doing anything in a feature receiver? – Rob D'Oria Jul 28 '11 at 23:00

It sounds like SharePoint is trying to activate your feature using a SolutionID instead of a FeatureID. Make sure you did not use the same guid as both a FeatureID and a SolutionID.

|improve this answer|||||
  • Those are quite different and have not changed at all. The project has deployed more than once before but now all of a sudden this error. – ChiliYago Jul 29 '11 at 22:09

The problem was that I added the solution ID to the Activation Dependency list instead of the Feature ID.

|improve this answer|||||
  • Isn't this almost exactly what Laurie suggested? – SPDoctor Aug 2 '11 at 12:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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