I'm new to SharePoint development, and I'm making a basic Visual Web Part with Visual Studio 2015, which currently only displays a header. It successfully builds and deploys, however the SharePoint 2016 site returns the error:

A Web Part or Web Form Control on this Page cannot be displayed or imported. The Type <Namespace>.VisualWebPart1.VisualWebPart1, ..., PublicKeyToken=<#> could not be found or is not registered as safe.

The Properties window of the Web Part has all the correct information, and after some digging I've discovered that the web.config file doesn't update correctly. In this post, examining a similar error, the chosen answer explains that the Manifest.xml file handles the web.config updating, and I've noticed that VS hasn't (and I suspect won't) make this file for me.

Is there a fix in Visual Studio that I can correct to have it make this file for me, or do I have to make this manually? If I do have to make the Manifest manually, what does it consist of?

  • Sounds like the DLLs are not being sent to the GAC. Is the a farm of sandbox solution?
    – lazoDev
    Nov 6, 2018 at 20:22
  • It is a farm solution.
    – gsamerica
    Nov 6, 2018 at 21:18

1 Answer 1


When webpart deployed successfully, there will be a SafeControl map to web part.

For example:

enter image description here

<SafeControl Assembly="SP2016Project, Version=, Culture=neutral, PublicKeyToken=3d20aa9b415aaf50" Namespace="SP2016Project.FirstVisualWebPart" TypeName="*" Safe="True" />

If you can't find this in your web.config(C:\inetpub\wwwroot\wss\VirtualDirectories\port), you could try to register it manually.How to get assembly PublicKeyToken

  • The Safe Control Entries for the project are exactly as above. While I can manually add the VisualWebPart to the Safe Control, I would prefer not to do this every time I create one. If the Safe Control Entries are correct, why would the WebPart not be added to the web.config?
    – gsamerica
    Nov 7, 2018 at 16:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.