Developing SharePoint 2010 solutions in Visual Studio 2010.
There is a problem in Visual Studio when deploying a solution with activationdependencies. Consider the following scenario.
There are two features A and B, both are both site or web scoped. A has an activation dependency on B and B is hidden. When deploying the solution Visual Studio tries to activate both features. First it activates A. This automatically activates B since it's hidden. Then when Visual Studio tries to activate B it failes with the error: "Error occurred in deployment step 'Activate Features': Feature 'B' (ID: <feature id>) is already activated at scope '<site url>'."
This can be solved by installing Mavention Activate Selected Features and selecting only feature A for activation. Visual Studio should however be able to correctly activate features without relying on 3rd party extensions.
The next problem arises when trying to retract or do a second deploy. Visual Studio will again try to deactivate both features. First A is deactivated and because of the activation dependency and that feature B is hidden this will simultaneously deactivate B. When Visual Studio then tries to deactivate B it fails with the error: "Error occurred in deployment step 'Retract Solution': Feature '<feature id>' is not activated at this scope."
Possible solutions that I can think of:
B is deactivated before A. (I have not found a reliable way of controlling the order of deactivation)
B is never deactivated directly by Visual Studio. (I have not found an equivalent of Mavention Activate Selected Features for feature deactivation)
Visual Studio ignores the error caused when the feature is not activated.
Please note that it seems that the order of activation/deactivation sometimes is reversed. If this happens then simply switch the role of feature A and B (set A as hidden, B as visible, and reverse the activationdependency).