Renaming Default Names - Visual Studio 2010 SharePoint Tools

When using Visual Studio 2010 SharePoint Development Tools for a SharePoint site, renaming the default name (WebPart1) can be a hassle.

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.


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.

Andrew Connell
Developer & Chief Course Artisan, Voitanos LLC. | Microsoft MVP
Written by Andrew Connell

Andrew Connell is a web & cloud developer with a focus on Microsoft Azure & Microsoft 365. He’s received Microsoft’s MVP award every year since 2005 and has helped thousands of developers through the various courses he’s authored & taught. Andrew’s the founder of Voitanos and is dedicated to helping you be the best Microsoft 365 web & cloud developer. He lives with his wife & two kids in Florida.

Share & Comment