SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

share|improve this question
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.

share|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
up vote 0 down vote accepted

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

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

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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