Tuesday 11 April 2017

Unable to deploy the feature

1)Unable to deploy the feature from visual studio after renaming it

2)What is causing a "Cannot find a Feature" error when uninstalling a solution?

3)Remove feature using id force

4)Uninstalling feature with force command doesn't work

5)Feature with ID 15/.. has already been installed. Use the force attribute to explicitly re-install the feature

Solution :

Finally  I was able to deploy the solution.

Following below PowerShell's

1)"Uninstall-SPFeature<Guid> -force" will not work.

You should use "stsadm-o uninstallfeature -id <Guid> -force" instead.

2)The solution cannot be deployed.  The feature  uses the directory  in the solution. However, it is currently installed in the farm to the directory

The reason why they don't show up in PowerShell is the missing Scope, those feature are orphaned, indeed. We cannot use -Site parameter. What you can do is to list it in PowerShell without -Site parameter and filter out those without Scope:

Get-SPFeature | ? { $_.Scope -eq $null }

This will give you a complete list of orphaned features.

The workaround is to use the DisplayName to get the spfeature (actually SPFeatureDefinition) and then delete it.

$feature = Get-SPFeature | ? { $_.DisplayName -eq "My_Orphane_Feature" }
$feature.Delete()

I have tested this code and it has worked for me.

You can even use this code to clean all the orphaned features:

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

No comments:

Post a Comment