Problem Statement
When creating a custom content type, derived from the Document Content Type with one additional text field, using Visual Studio 2010 and deploying via F5, the first time deployment will work fine, second time failed with this error:
Error occurred in deployment step ‘Activate Features’: The field with Id {a6a841d7-4067-4519-b794-e25ac438e9cf} defined in feature {a6192d76-512f-48de-9284-251b49902345} was found in the current site collection or in a subsite.
Microsoft has acknowledged this as a problem, and is working on a fix.
Workaround
To workaround this problem and to continue to enjoy your Visual Studio 2010 debugging experience, you will need to follow these steps.
1. F5 (Deploy the solution)
2. Shift +F5 (Retract the solution)
3. Again F5. This time it will fail.
4. Open the task manager and kill VSSPHost4 process.
(Ideally we need to kill the VSSPHost4 process any time you see the error message during the F5 deployment.)
To make it easier on myself, I kill the VSSPHost4 process from an SharePoint 2010 Management Shell, run as Administrator, like this:
stop-process -processname vssphost4 -force
5. Now F5 and the solution will get deployed successfully.
You could also avoid this error, but installing and deploying the feature outside the Visual Studio 2010 debugger, either thru STSADM or thru PowerShell!
Hope this saves you some time.
Tom
Details on How to Reproduce, if you care.
-
In Visual Studio 2010, create a new “ContentType” project,

-
Specify the site and solution type.
The site should be a site collection, not a subsite.
The solution should be a farm solution.
- Inherit this new content Type from the Base Content Type of “Document”
-
Replace the contents of Elements.xml with this contents:
<?xml version=”1.0″ encoding=”utf-8″?>
<Elements xmlns=”http://schemas.microsoft.com/sharepoint/“>
<!– Parent ContentType: Document (0×0101) –>
<Field ID=”{D6A841D7-4067-4519-B794-E25AC438E9CF}”
Name=”MyCustomField”
StaticName=”MyCustomField”
DisplayName=”MyCustomField”
Description=”MyCustomField”
Group=”abc”
Type=”Text”
SourceID=”http://schemas.microsoft.com/sharepoint/v3” />
<ContentType ID=”0x010100b19e17b94ee044778dcffe8f92ce18e6″
Name=”ContentTypeProject2 – ContentType1″
Group=”Custom Content Types”
Description=”My Content Type”
Inherits=”TRUE”
Version=”0″>
<FieldRefs>
<FieldRef ID=”{D6A841D7-4067-4519-B794-E25AC438E9CF}” Name=”MyCustomField”/>
</FieldRefs>
</ContentType>
</Elements>
- Hit F5 to compile and deploy this Content Type.
- After the SharePoint site is displayed, verify the content type exists.
-
Back in VS2010, hit Shift-F5 to stop debugging.
- Hit F5 to redeploy this Content type and it will fail with the following error:
Error occurred in deployment step ‘Activate Features’: The field with Id {a6a841d7-4067-4519-b794-e25ac438e9cf} defined in feature {a6192d76-512f-48de-9284-251b49902345} was found in the current site collection or in a subsite.
-
Now edit the elements.xml file, by changing the GUID, and set the Overwrite attribute to TRUE, you will not be able to deploy and reploy over and over again.
<?xml version=”1.0″ encoding=”utf-8″?>
<Elements xmlns=”http://schemas.microsoft.com/sharepoint/“>
<!– Parent ContentType: Document (0×0101) –>
<Field ID=”{A6A841D8-4067-4519-B794-E25AC438E9CF}”
Name=”MyCustomField”
StaticName=”MyCustomField”
DisplayName=”MyCustomField”
Description=”MyCustomField”
Group=”abc”
Type=”Text”
Overwrite =”TRUE”
SourceID=”http://schemas.microsoft.com/sharepoint/v3” />
<ContentType ID=”0x010100b19e17b94ee044778dcffe8f92ce18e6″
Name=”ContentTypeProject2 – ContentType1″
Group=”Custom Content Types”
Description=”My Content Type”
Inherits=”TRUE”
Version=”0″>
<FieldRefs>
<FieldRef ID=”{A6A841D8-4067-4519-B794-E25AC438E9CF}” Name=”MyCustomField”/>
</FieldRefs>
</ContentType>
</Elements>