查询Feature的名称及ID

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

            var dd = from i in SPFarm.Local.FeatureDefinitions

                     where i != null && i.RootDirectory.Contains("NanmuThemes")

                     select i;

            //NanmuThemes

            //290836a1-823f-4b34-9268-6727546e5dab

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

            foreach (SPFeatureDefinition featdef in dd)

            {

                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();

                }

            }

如果出问题,可以使用

C:\>stsadm.exe -o uninstallfeature -id <id> –force 卸载

 

 

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

            var dd = from i in SPFarm.Local.FeatureDefinitions

                     where i != null && i.RootDirectory.Contains("NanmuThemes")

                     select i;

            //NanmuThemes

            //290836a1-823f-4b34-9268-6727546e5dab

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

            foreach (SPFeatureDefinition featdef in dd)

            {

                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();

                }

            }

如果出问题,可以使用

C:\>stsadm.exe -o uninstallfeature -id <id> –force 卸载 

 

 http://blogs.msdn.com/b/tehnoonr/archive/2009/02/15/resolving-the-error-failed-to-find-the-xml-file-at-location-12-template-features-feature-name-feature-xml.aspx

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! 

 

 

 

 

转载于:https://www.cnblogs.com/ceci/archive/2012/02/24/2366060.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值