Tuesday, April 29, 2014

SharePoint - Error occurred in deployment step 'Activate Features': Operation is not valid due to the current state of the object

This error can appear when you try to deploy your SharePoint solution, but this message has no detailed data so it is not obvious how to solve it. 




There are few things you can do to remove this error:
 
1. If you changed namespace or assembly name or class name in your solution, you have to check that you have the same namespace and assembly and class name in your Elements.xml file. This is the most common error. Check out Sue Hernandez's blog for more details on this:
http://suehernandez.wordpress.com/2011/03/31/error-occurred-in-deployment-step-activate-features-operation-is-not-valid-due-to-the-current-state-of-the-object/

2. If you still have the same error after step one try restarting SharePoint Timer Service and do an IISRESET.


3. If step 2 didn't resolve your error, check if your deployment target is set to "WebApplication". It needs to be set to "Global AssemblyCache" instead.


3.1. Click on you project name in your solution.
3.2. In Properties window, set "Assembly Deployment Target" option to "GlobalAssemblyCache".
3.3. Close Visual Studio.
3.4. Restart server.

After your server restarts, you should be able to deploy solution without any errors.

1 comment: