11

I have a weird error when trying to deploy a solution via Visual Studio 2010:

Error 1 Error occurred in deployment step 'Add Solution': The solution cannot be deployed. The feature 'XXXX-XXXX-XXXX-XXXX' uses the directory "Solution_Feature1" in the solution. However, it is currently installed in the farm to the directory "WepPartName". Uninstall the existing feature before you install a new version of the solution.

Powershell comes with Get-SPFeature and lists all available Features currently installed. The Feature is listed but has no scope. All other features do have scopes which is the first thing that I recognized.

I tried to uninstall the feature using Uninstall-SPFeature cmdlet:

Uninstall-SPFeature : Cannot find a Feature object with Path or Id: XXX-XXX-XXX-XXX in scope Local farm. At line:1 char:20 + Uninstall-SPFeature <<<< -Identity XXX-XXX-XXX-XXX -Force + CategoryInfo : InvalidData: (Microsoft.Share...ninstallFeature:SPCmdletUninstallFeature) [Uninstall-SPFeature], S PCmdletPipeBindException + FullyQualifiedErrorId : Microsoft.SharePoint.PowerShell.SPCmdletUninstallFeature

I have searched for both the GUID and the web part name on the machine it has been previously deployed but with no success.

8 Answers 8

17

This can occur when an installed feature is renamed. Either reverse the rename or uninstall the feature.

PowerShell's Uninstall-SPFeature <Guid> -force will not work. You should use stsadm -o uninstallfeature -id <Guid> -force instead.

2
  • 2
    PowerShell (Uninstall-SPFeature) did work for me. Commented Apr 10, 2012 at 2:11
  • And now Powershell didn't work. The stsadm did! So I would give another +1. Thanks again!
    – jumbo
    Commented Jul 9, 2013 at 10:29
12

There is a related question on SharePoint StackExchange:

How to remove orphaned features

Remove all the orphaned features:

Get-SPFeature | ? { !$_.Scope } | % { $_.Delete() }
1
  • 1
    original code for finding orphans was Get-SPFeature | ? { $_.Scope -eq $null } . Be careful not to delete non-orphaned features.
    – oglester
    Commented Aug 28, 2017 at 20:53
3

Try to uninstall the feature using Uninstall-SPFeature <Guid> -Force, where GUID is the guid that you get from the Get-SPFeature cmdlet.

2

Reference 1 and Reference 2 both are useful URL's. It's worked for me to uninstall the solution with Feature ID and then installed it. Hope it would be helpful to others!

1

I had a similar issue when using VS while prototyping a feature copied from an existing feature, which was subsequentially deleted thus not allowing me to retract the solution via VS.

anyway resolution as follows using the unistallfeature commannd and ensure you force it.

stsadm -o uninstallfeature -id f6414364-6274-4bc1-ad66-1aa00cfd2944 -force

1
  • stsadm -o uninstallfeature -id <Guid> -force worked!! Thanks Guys!
    – user12924
    Commented Nov 9, 2012 at 5:28
1

I faced similar issue as a result of SharePoint 2013 farm solution deployment failing in between. If a solution deployment fails it causes the SharePoint 2013 to retract the installed package. However during retraction it just deleted the feature folders and feature xml files copied during solution deployment but since farm scoped features gets deployed on installation remained so in the farm.

So to fix the issue I had to manually copy the feature files to feature folder under 15 hive and then run this command.
stsadm -o uninstallfeature -filename "Feature_Name\feature.xml" -force

0

Since this is only a developer machine I suggest you go hunting in SQL. I have definitely seen solution deployment problems when you delete a Site Collection with solutions deployed and then try to redeploy on a new site collection in the same url. This may be related.

2
  • Although this is being downvoted - the config database was the only Point I was able to delete features. STSADM or Uninstall-SPFeature didn't work. I had to search the Objects table for the features and manually remove them from there. After that I could redeploy. Upvote from me as a measure of last resort.
    – Dennis G
    Commented Jul 21, 2013 at 9:51
  • yeah this worked for me, too, on my dev server. I tried EVERYTHING else (9 in total including restoring an old back up of a content database) and I was about to re-create my VS project with new GUIDs and AssemblyName, when I found this post. I knew the answer was somewhere in SharePoint_Config but I didn't know where to look. Thanks for pointing me in the right direction! I deleted the offending row from table Objects and my problem went away!
    – Aaronster
    Commented Oct 1, 2013 at 20:10
0

Who are new to STSADM

Find the STSADM from below location for Sharepoint 2013

C:\Program Files\Common Files\microsoft shared\Web Server Extensions\15\BIN

enter image description here

enter image description here

Command : stsadm -o uninstallfeature -id 595f308c-b61a-4789-ac56-994c76b7731c -force

Your Answer

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