SharePoint 2010 projects with field elements cannot be redeployed

Original KB number:   2022443

Symptoms

When you deploy a sandboxed SharePoint solution if the Field IDs in the elements.xml file are modified between project deployments the following error is displayed:

'Error occurred in deployment of step 'Activate Features': the field with ID <New GUID> defined in feature <FeatureGUID> was found in the current site collection or in a sub site.

Cause

The root cause of this issue is that Field elements are not properly retracted after their ID (GUID) is changed between deployments. This is also caused if you forgot to enclose the Field ID (GUID) in braces.

Resolution

Note

Make sure that your Field IDs (GUIDs) are always enclosed in braces.

First resolution

  • Retract the Solution/WSP in VS.
  • Close VS.
  • Reopen VS and deploy the Project.

Second resolution

If closing VS after retraction doesn't solve the problem, then a larger workaround is:

  • Redeploy the project. This will show an error during feature activation.
  • Go to SharePoint UI and Activate and then Deactivate the deployed feature that was showing activation error in VS.
  • Retract the Solution/WSP in VS.
  • Close VS.
  • Reopen VS and deploy the Project.