SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question

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.

share|improve this answer
PowerShell (Uninstall-SPFeature) did work for me. – Daniel Little Apr 10 '12 at 2:11
Powershell worked for me! Thanks! – jumbo Feb 12 '13 at 9:49
And now Powershell didn't work. The stsadm did! So I would give another +1. Thanks again! – jumbo Jul 9 '13 at 10:29

There is a related question on SharePoint StackExchange:

How to remove orphaned features

Remove all the orphaned features:

Get-SPFeature | ? { !$_.Scope } | % { $_.Delete() }
share|improve this answer

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

share|improve this answer

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

share|improve this answer
stsadm -o uninstallfeature -id <Guid> -force worked!! Thanks Guys! – user12924 Nov 9 '12 at 5:28

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

share|improve this answer

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.

share|improve this answer
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 Jul 21 '13 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 Oct 1 '13 at 20:10

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.