Ever created a Web Part using the new Visual Studio 2010 SharePoint Development Tools for a SharePoint 2010 site? Say you accept the default name, WebPart1. It creates the SharePoint Project Item (SPI) in the Visual Studio project and adds all the necessary files you need like the code file, element manifest and Web Part definition. But then you decide you want to rename the darn thing… so you right-click the SPI in the project and rename it to something like MyWebPart. Making sure everything is cool, you verify the name of the Web Part class was updated, the Web Part definition & the element manifest is cool.
But when you deploy it and try to add it to a page, you get the dreaded “this control isn’t registered as safe” error. So what gives? Savvy SharePoint developers know this usually means they should go check the web.config and see if their Web Part is listed correctly, which they find it isn’t.
Why?
The SharePoint Development Tools have a special place where it lists the safe control entries it ads. If you pick the SPI in the Visual Studio project and then open the Properties tool window (hit [F4] if it isn’t there), you’ll see a collection of Safe Control entries. Make sure it’s correct there and you’ll be good to go.