Resolving the Error "Failed to find the XML file at location ’12TemplateFeaturesFeature_Namefeature.xml’"


Introduction


If you install a feature in your MOSS 2007 farm and after that the feature folder or the feature manifest file accidently gets deleted from your Web Front End servers file system, you will get the error “Failed to find the XML file at location ’12\Template\Features\Feature_Name\feature.xml” when you go to Site Settings –> Galleries –> Workflows. This is because your feature is still installed in the farm, and when you view the workflow gallery page, the page will go through all the features installed in your farm, and then read their corresponding manifest files from the file system to determine if the feature has a corresponding workflow associated to it. If the feature is installed and the corresponding manifest file has been deleted, this error will be thrown.


 Possible Causes of the Error


There are a couple of reasons (that I can think of) why you might get this error:



  1. Your current MOSS 2007 farm is an upgrade from a previous version (MOSS beta or SPS 2003). Some features were part of the previus version of MOSS but now have been deprecated.

  2. You installed the feature in your farm and accidently deleted the feature manifest file from the file system of the web front end server. Feature folders are located at “C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\TEMPLATE\FEATURES”.

 Resolving the Error


There are two possible resolutions to this problem:


1. If you have the original feature manifest file and the feature folder, just copy that entire folder back on the file system of all web front end servers at the path mentioned above (C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\TEMPLATE\FEATURES). Ask developers on your team if they have deployed any features in the farm and get the manifest file from them if you don’t have them.


2. This second resolution is for the scenario if you have completely lost the feature manifest file, or if the feature was in an older version of MOSS, and now you have upgraded your MOSS farm and the feature has been deprecated. The only way out in this situation is to uninstall the feature using an stsadm comand. Normally, you can uninstall features by using the feature name and stsadm, but in this situation, because there is no feature manifest available, you will have to uninstall the feature using the feature GUID. Following is a sample code that you can use to figure out the GUID of the feature that has a missing manifest file. Just put this into a C# Cosole Application and execute on your web front end server:


   List<Guid> featIDs = new List<Guid>();
            foreach (SPFeatureDefinition featdef in SPFarm.Local.FeatureDefinitions)
            {
                try
                {
                    Console.WriteLine(featdef.RootDirectory + “——-” + featdef.Id.ToString() + “——-” + featdef.GetTitle(System.Threading.Thread.CurrentThread.CurrentCulture));
                }
                catch
                {


                    //This code will be executed if the feature does not have the manifest file.
                    Console.WriteLine(“################################################”);
                    Console.WriteLine(“Error Ocurrred! Attempting to get feature ID of the feature without manifest file…:”);
                    Console.WriteLine(featdef.Id.ToString());
                 }
                finally
                {
                    Console.WriteLine();
                    Console.WriteLine(“Press enter to view next feature”);
                    Console.ReadLine();
                }


          }


 Once you have the feature GUID, you can use the following stsadm command to get rid of this feature:


stsadm.exe -o uninstallfeature -id <feature_giud> -force.


Once you do this, we should be good!

Comments (14)

  1. Xenox Garavito says:

    Thanks for this pointer.  Worked great to tie up the loose ends in development

  2. Dave says:

    Great Post.  Was struggling with this for a couple of hours.  Started out with SPWeb.Features, but that collection is only accessible via guid, which is what I was trying to get.

  3. Thanks for this tip! Got me out of trouble fast!!!

  4. Jim says:

    Thank you for posting this code.  It identified the offending feature(s) to the degree that I was able to run stsadm.exe, as suggested, to remove them.

    Vielen dank!

  5. Create a new console application and change the code as :-

    1) Add the sharepoint references

    using System;

    using System.Collections.Generic;

    using System.Linq;

    using System.Text;

    using Microsoft.SharePoint;

    using Microsoft.SharePoint.Administration;

    namespace GetFeatureGuid

    {

       class Program

       {

           static void Main(string[] args)

           {

               List<Guid> featIDs = new List<Guid>();

               foreach (SPFeatureDefinition featdef in SPFarm.Local.FeatureDefinitions)

               {

                   try

                   {

                       Console.WriteLine(featdef.RootDirectory + "——-" + featdef.Id.ToString() + "——-" + featdef.GetTitle(System.Threading.Thread.CurrentThread.CurrentCulture));

                   }

                   catch

                   {

                       //This code will be executed if the feature does not have the manifest file.

                       Console.WriteLine("################################################");

                       Console.WriteLine("Error Ocurrred! Attempting to get feature ID of the feature without manifest file…:");

                       Console.WriteLine(featdef.Id.ToString());

                   }

                   finally

                   {

                       Console.WriteLine();

                       Console.WriteLine("Press enter to view next feature");

                       Console.ReadLine();

                   }

               }

           }

       }

    }

    Build the code and run the solution. You need to press the enter key for all the installed features n your farm.

    If any feature is missing the manifest.xml file , then it will show the error like "Error Ocurrred! Attempting to get feature ID of the feature without ……". There will be the GUID of that feature int the error.

    Remove that feature by hitting the following command :-

    stsadm.exe -o uninstallfeature -id <feature_giud> -force.

    Thanks

    -Shiv

  6. RGayle says:

    You can also just use Sharepoint Manager to find the GUID. It even told me which Feature had an error and displayed the same error message for that feature.

  7. RGayle says:

    No you can't, it was giving me the wrong ID

  8. SP Developer says:

    Nice one… and also superb solution..

    thanks

  9. Sudheekar Reddy says:

    Thanks Yar, Nice Post…

    Really worked great

  10. john says:

    Hey am sorry for this question but i am all new to sharepoint.

    how do you run a console application on the web front end server

    thank you

  11. Hey John,

    When you compile/build a console application project in visual studio, you get an .exe file. All you need to do is copy your exe file on the SharePoint server and just double click on it (or run from command prompt).

    Hope it helps!

  12. Does not work says:

    Error 1 The type or namespace name 'SharePoint' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?) c:usersgtate.ldidocumentsvisual studio 2010ProjectsSPFeature VerificationSPFeature VerificationProgram.cs 9 17 SPFeature Verification

    Error 2 The type or namespace name 'SharePoint' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?) c:usersgtate.ldidocumentsvisual studio 2010ProjectsSPFeature VerificationSPFeature VerificationProgram.cs 11 17 SPFeature Verification

    Error 3 'GetFeatureGuid.SPFarm' does not contain a definition for 'local' c:usersgtate.ldidocumentsvisual studio 2010ProjectsSPFeature VerificationSPFeature VerificationProgram.cs 28 60 SPFeature Verification

    Error 4 Type expected c:usersgtate.ldidocumentsvisual studio 2010ProjectsSPFeature VerificationSPFeature VerificationProgram.cs 28 13 SPFeature Verification

  13. PaulE says:

    Thanks! Gave me the info needed to clean up from High level ULS log errors, "Failed to find the XML file at location '14TemplateFeatures[featureName]feature.xml'". Uninstall-SPFeature in PowerShell wouldn't work, but the stsadm command you gave did. Glad I did this before the upgrade to SP2013!

  14. diwas says:

    Actually Stsadm-O command will work for any feature no matter what ID you give. So basically it is not working. If you run the code again you will still find the missing feature.

    The code however is great, but not sure why the feature is not removed.