3

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.

2
  • i have found that the schema definition deployment of sharepoint is brilliant for one off deployments. But if you are doing any kind of iterative approach, or you think you will ever need to upgrade your component (which is nearly always), then a code based approach for provisioning is just going to give you the control/stability you want/require.
    – djeeg
    Jan 14, 2011 at 11:39
  • Code based approach as in spSite.Fields.Add compared to the XML approach? Interesting approach!
    – Dennis G
    Jan 14, 2011 at 23:40

2 Answers 2

3

I have noticed that if you deploy a site column in a feature, then retract the solution, then deploy again, the feature is no longer listed in site columns. However, if you do an IISRESET and then check site columns, the column reappears. This suggests that SharePoint is cacheing the schema at some level. So my recommendation would be to force an iisreset after redeploying schema changes which should result in slightly more consistent behaviour.

2

I still don't know how to really delete fields - but actually Overwrite="TRUE" OverwriteInChildScopes="TRUE" for the field WORKS!.

The second error message i received ("duplicate field names") is actually due to two identical fields being defined in my .xml file.

1
  • Thanks Your post really helped me (3days on this problem).
    – user4817
    Sep 15, 2011 at 9:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.