Well it seems like this is a problem some people are having, but I can't seem to find the definite solution.
I deployed some Site Columns to Sharepoint using a feature, let's go with the following example:
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<Field Type="Text" DisplayName="Test" StaticName="Test" Name="Test" Group="Group" ID="{12C5DE50-14B1-425C-8A5B-7430726526E1}">
</Field>
</Elements>
Now I wanted to add a second column to my "deployment package" (leaving in the first column/field with the same ID as previously deployed). So I added said column to my package, retracted the previous solution, but now get the error:
Error occurred in deployment of step ‘Activate Features’: the field with ID defined in feature was found in the current site collection or in a sub site.
It is suggested here on MSDN blogs to "close and re-open Visual Studio" or "to retract the feature, re-deploy, close and re-open". Nothing of that seems to work.
A french site suggested using Overwrite="TRUE" OverwriteInChildScopes="TRUE"
for the Field
definitions - I did so and instead of getting the "ID existing" I now get the error (please see my answer below! Overwrite=TRUE is the solution)
Error occured in deployment step 'Activate Features: A duplicate field name "Test" was found.
- When checking Sharepoint (Site Settings > Site Columns), my "existing" columns are nowhere to be found
- I did an IIS reset, I did close, re-open and swung my magic stick with Visual Studio
I read something about a "stale cache" Sharepoint uses... I do not want to change the GUIDs on the fields every time I deploy anew the same as I don't want to cludder up Sharepoint with old remnants of non-existing fields.
How do I really remove all references to these previously deployed fields?
EDIT: I now even tried a code based deletion approach: Iterating all fields via SPWeb.Fields
. The fields are not even to be found like this - yet I cannot deploy them.
spSite.Fields.Add
compared to theXML
approach? Interesting approach!