Upgrade web part

Jan 26, 2009 at 5:03 PM
Edited Jan 26, 2009 at 5:05 PM
I've used the Web Part Template project to create a new web part, and rolled this out to our development server using the generated ".wsp" and Setup file.  This all works fine.

However if I then decide to make changes to the web part code, and upgrade it on the server, the ".webpart" file is not updated in web sites that use this web part.

If I manually update the ".webpart" file then existing web parts fall over with the following error: "Web Part Error: A Web Part or Web Form Control on this Page cannot be displayed or imported. The type could not be found or it is not registered as safe." 

This error presumably comes up because the ".webpart" file version doesn't match the version of the web part that was added to the page.

What am I doing wrong - what's the correct way of upgrading a web part in SharePoint using the SharePointInstaller?