I recently was creating a SharePoint Farm solution that adds Diagnostic Categories in Central Administration. This allows my other solutions to reference this class for the purpose of logging events using SharePoint Diagnostic infrastructure. If you want to do this take a look at Todd Carter’s web site for info.
During normal development of this solution deploying, retracting, and removing repeatedly is typical refrain. Soon I noticed my Diagnostic Categories where duplicating themselves. It was driving me nuts because I thought all remnants of my solution would be removed after the Remove-SPSolution cmdlet was executed.
I then posted on StackOverflow asking where these categories are actually saved so I could determine if my old categories remained following the Remove-SPSolution cmdlet was executed. Chris Beckett gave me a clue.
I turned my attention to the configuration database and found references to my custom classes in the Farm Configuration Database’s Classes and Objects table. I know touching SharePoint Databases directly are not supported but since this was my own development box I figured what the hell and ran the following SQL script to remove the records from these tables.
DELETE FROM dbo.Classes WHERE FullName like ‘TimOdellCustomSolution%’
WHERE ClassId IN (SELECT [Id] From [SP_Config_Farm].[dbo].[Classes] WHERE FullName like ‘TimOdellCustomSolution%’)
After deleting the records and re-deploying my solution no more duplicates were seen.
If this helps you please let me know! Thanks for reading!