This issue described here is actually more of a Visual Basic issue than SharePoint, but it often pops up in SharePoint web part deployment.
The issue: You create a web part in C# with a “namespace Max.Demo”, build it, deploy the DLL, add it to safe controls and go to Site Actions, Site Settings, Web Part Gallery, New Web Parts. It shows up in the list just fine with a name like: assemblyname.namespacename.classname.
You try the exact same steps above using Visual Studio, and the web part does not show up in New Web Parts.
The problem is with the namespace and how you entered it into <SafeControls>, actually it’s because you did not know the real namespace name.
In C# when you add “namespace Max.Demo” to a class then that is the namespace name generated. In VB when you add “namespace Max.Demo” you are creating a namespace name that is built from two parts, what you typed added to what is specified in the project’s properties screen as the “Root namespace”.
So in VB if your properties look like this:
and your code looks like this:
VB creates a namespace named: MyWebPartProject.Max.Demo
So for VB projects:
- Only set your namespace in Project Properties
- Or delete the namespace in Project Properties (leave it blank) and set the namespace in code
- Or remember that the namespace in Project Properties is combined with what you set in code
If you want to see just how everything got named then create a little project with this code: