Menu Home

Removing SPClaimProvider when File Not Found

Currently I’m working on a project where we are developing a custom claims provider, by inheriting from the SPClaimProvider class and installing it with a farm feature that inherits from SPClaimProviderFeatureReceiver. This worked great until we did some refactoring of the code when moving it from a prototype to production ready code. During this process the public key of the assembly was changed, and for some reason that left a reference to the old assembly in my development SharePoint farm.

When I did Get-SPClaimProvider from powershell, sharepoint would still have a reference to the old assembly. Trying to reinstall the updated claim provider from the feature would also fail, with a strange “File Not Found” exception. Apperantly the feature receiver will on install, try to uninstall existing claimproviders with the same name, and since the assembly from the original version of the claim provider couldn’t be found this process failed.

Luckily the powershell cmdlet Remove-SPClaimProvider is less restrictive it simply removes the claim provider regardless of whether the assembly is missing.

The command used was:
Remove-SPClaimProvider –Identity “NameOfClaimProvider”

Categories: SharePoint

Tagged as:

Simon J.K. Pedersen

Leave a Reply

Your email address will not be published. Required fields are marked *