# Uninstalling feature with force command doesn't work

I have deployed a WSP (say Home.wsp) in a webapplication. This Home.wsp has myFeature. This feature was moved to another VS project to generate a WSP itself (say myFeature.wsp) . The problem is that I am trying to uninstall the oldest feature inside Home.wsp with no luck when I run this code in a console application the guid somewhere still remains

foreach (SPFeatureDefinition featdef in SPFarm.Local.FeatureDefinitions)
{
try
{
}
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");
}


I tried with this command stsadm.exe -o uninstallfeature -id d36a20c7-f9a2-48ca-b371-10ace773785a -force It says Operation Completed but the feature is still somewhere

Anyone has an idea how to remove completely the reference of the feature? The WebApplication is deleted and de Farm Solutions are retracted!

Thanks

It is always tricky to remove features that no longer has their manifest in the Features catalog in the hive. This tool has helped me out with the same problem before: http://featureadmin.codeplex.com/

And just for the record, forcing an uninstallation of a feature is really just hiding any errors

• Thank you. I used this tool before. I got the old Home.wsp, then deployed and retracted it. The wrong feature was gone. – Alvmad May 3 '13 at 7:16

Since you're running a SharePoint 2013 environment, why not use PowerShell 2013 instead of stsadm.exe?

# Uninstalls feature at path:
# \$env:ProgramFiles\Common Files\Microsoft Shared\Web Server Extensions\15\TEMPLATE\FEATURES\MyCustomFeature/feature.xml.

Uninstall-SPFeature -path "myFeature" -force


Reference: Uninstall-SPFeature

If that doesn't work - maybe you forgot to deactivate the feature before retracting? Or if you didn't remove all your files in the FeatureDeactivation() method?

If the Feature contains components that can be managed in Microsoft SharePoint Designer, deleting the component in the designer will remove the files.

When the feature is deactivated, you can retract the solution, but it isn't removed from the farm.

Removing: Deletes the solution package from the solution store. This step requires a farm administrator and can be done with either Central Administration, SharePoint Management Shell, or the object model.

Reference: Uninstallation and Retraction of a Farm Solution

With powershell - rectract the solution with:

Uninstall-SPSolution -Identity Home.wsp


... and remove it the same way:

Remove-SPSolution -Identity Home.wsp


References: Uninstall-SPSolution, Remove-SPSolution

• You are right. I should use these commands instead. – Alvmad May 3 '13 at 7:15
• You are right. I should use these commands instead.Thank you – Alvmad May 3 '13 at 7:15