4
Vote

Cleaning web parts on uninstall

description

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" />
    </File>
</Module>
</Elements>
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.

comments

kliemohn wrote May 30, 2008 at 6: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.