Udostępnij za pośrednictwem


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.

I ran into this issue a couple times now and figured I’d write down the “workaround”.  I say workaround as this is not a real fix as from my understanding a bug has been filed and the product group(s) are working on a resolution.  The KB article to the work around is here: https://support.microsoft.com/kb/2022443 but just in case the link goes away here are the steps:

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.

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.

Comments

  • Anonymous
    October 19, 2010
    Hi, I tried most of workaerrounds for that, but none helped. It comes out that it was because Fields Guids I was using were in the same range (just done a +1 on each field). Putting real generated Guids for each field solved the problem for me.

  • Anonymous
    December 13, 2010
    It doesn't work for me, because trying to activate the feature in Sharepoint UI I get the following error in turn: The field with ID defined in feature was NOT found in the current site collection or in a sub site. So VS tells me the field was found throwing therefore an error, whilst Sharepoint tells me the field was NOT found throwing an error as well... Anybody knows how to solve this without creating all the site collection from the scratch ?

  • Anonymous
    December 21, 2010
    Really really reeeaallly irritating problem that shows up frequently. I sure hope Microsoft support will pick this one up and not leave it with the KB article describing these workarounds. Anyhow, I've got another workaround to add to the list. It has its pros and cons over the other two: You can also generate a new GUID and replace both the GUID AND the Name/Staticnames in your field definition and in the list definitions. This way you don't have to restart Visual Studio. Simply redeploy from Visual Studio after updating the fields and the error is gone. Ideal if you have a simple field / definition reference. Less ideal if you have references all over your solution. You decide.

  • Anonymous
    February 08, 2011
    First resolution worked for me. Thx.

  • Anonymous
    February 09, 2011
    The first one worked for me.  Sweet.

  • Anonymous
    February 17, 2011
    I received this error after changing GUIDs.  The first resolution worked for me.  Incidentally, my GUIDs are currently +1 manual changes as well.

  • Anonymous
    March 15, 2011
    The first workaround worked for me. Thank you!!

  • Anonymous
    September 12, 2011
    The first workaround worked for me. Thank you!!

  • Anonymous
    September 25, 2011
    The Problem is because when ever we deploy any list instance with new fields then the List will be created and simutaneously columns will be added in Site columns Custom Columns section, we need to delete thm when evar we redploy our solution or we can write a eventhandler deactivating event to delete the custom site columns so that when ever we redeploy system will not throw this type of Error

  • Anonymous
    November 15, 2011
    Thanks... second one working for me

  • Anonymous
    February 20, 2012
    "Make sure that your Field IDs (GUIDs) are always enclosed in braces", thanx alot for this note :)

  • Anonymous
    March 28, 2012
    The first workaround worked for me. Thank you!! I have faced this issue due to create a incorrect data type column.

  • Anonymous
    June 21, 2012
    Hello Make sure that the list targeted by the event reciever exists if does not exist create it ;) Cheers

  • Anonymous
    September 02, 2013
    OK, thanks for the heads up, in addition to the above, you need to write some code in the Feature Deactivate event in the Feature Receiver: public override void FeatureDeactivating(SPFeatureReceiverProperties properties)        {            using (SPSite site = new SPSite(properties.Feature.Parent.ToString()))            {                using (SPWeb web = site.OpenWeb())                {                    for (int i = 0; 1 < web.Fields.Count; i++)                    {                        if (web.Fields[i].Group == "[Your Group Name]")                            web.Fields[i].Delete();                    }                }            }        } This code will make sure there are no orphan GUIDs hanging out... SharePoint loves to leave bits and pieces out there. Enjoy, -- Dave

  • Anonymous
    December 05, 2013
    I tried the both options, but they didn't resolved the issue. But along with those, I restarted my powershell ISE window too(which might not be used in your case for deployment), which I was using to deploy the solution has resolved the issue. Thanks for info.

  • Anonymous
    February 10, 2014
    Second one worked for me,... :) thanks

  • Anonymous
    June 24, 2015
    Solution 1 resolved my issue. Thanks!!!!