Cleaning web parts on uninstall


My feature reffers elements.xml with:
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
<Module Name="ABC Solution" List="113" Url="_catalogs/wp">
    <File Url="my.webpart" Type="GhostableInLibrary">
        <Property Name="Group" Value="My Group" />
        <Property Name="QuickAddGroups" Value="My Group" />
Install works just fine and web part goes to web part gallery. However, uninstall doesn't remove the web part from it. Furthermore, the next install doesn't update existing web part in web part gallery. Please advice.


kliemohn wrote May 30, 2008 at 5:28 PM

All of the issues mentioned here are just part of the way that web parts are dealt with when deploying solutions and activating features. This SharePoint Solution Installer just tries to wrap that capability. I don't think we will want to extend it for this case.

The way you would handle this is to write a custom feature activated/deativated receiver.

Note that you may not want to do too much cleanup when uninstalling/deactivating because data is stored with the web part (web part properties) and this data will be lost. The way things currently work the data is not lost; you can uninstall and reinstall and the old data is still there.

wrote Jun 27, 2008 at 1:46 PM

wrote Jan 15, 2009 at 9:36 PM

wrote Feb 14, 2013 at 7:56 PM