windows-broken-mini

Error – Directory “FeatureDirectoryName” associated with feature ‘GUID1’ in the solution is used by feature ‘GUID2’ installed in the farm.

The solution cannot be deployed. Directory “FeatureDirectoryName” associated with feature ‘GUID1’ in the solution is used by feature ‘GUID2’ installed in the farm. All features must have unique directories to avoid overwriting files.

I’ve ran into this error three times now. It happens when you create two projects with the same name. This error can happen when you have two solutions with the same name, one of the solutions has a fatal exception in the Feature EventReciever when being retracted or deployed.

If you go to PowerShell and Get-SPSolution it wills how the feature. So naturally, you run a Remove-SPSolution or a Uninstall-SPSolution, both commands return, “Solution does not exist”. This is totally weird, the get finds it, but the Remove/Uninstall does not. I have a theory about why, I think the Uninstall/Remove are doing a join between the SharePoint_Config and the Content Databases.

The First Time I ran into this error, I wasted most of a day and ended up rebuilding the entire farm. The second time I wasted a half of day and managed not to rebuild the farm. The third time I decided I’d write it down.

So, basically, once you’ve verified no remnants of the solution in the content databases proceed to deleting the solution from the SharePoint_Config.

Here is the script to verify it doesn’t exist in Content Database. (Run this against each content database)

use [WSS_Content]
select * from dbo.Features where FeatureId = 'Guid2'

**If this returns results, you should be able to fix the problem Powershell commands and I don’t recommend proceeding.

Okay, so we’ve verified there are no shreds of you Solution Feature laying around any content databases. Lets see if we can find it in the SharePoint_Config database.

use [SharePoint_Config]
Select * from ObjectS WHERE Properties LIKE '%Guid2%'

Run this script, it should return a single result. If it doesn’t, well, you’ve got problems I’ve never had. Anyway, so it returns a single row, change the select statement to delete and void your warranty with Microsoft.

use [SharePoint_Config]
Delete from ObjectS WHERE Properties LIKE '%Guid2%'

More seriously, I’ve only ran into/caused this problem in development. Never in production and I wouldn’t recommend this in production unless it is a last ditch effort.

About the author

Leave a Reply