I have a SharePoint 2013 web site with custom web parts. Lately, I've been running into an issue in which all the safecontrol elements that correspond to my custom webparts disappear from SharePoint's web.config immediately after I deploy the site's WSP. By safecontrol element, I refer to the following as an example:

 <SafeControl Assembly="MyApplication, Version=, Culture=neutral, PublicKeyToken=69dcf65f3fee0271" Namespace="MyApplication.MyWebPart" TypeName="*" Safe="True" />;

I use the following Powershell command when updating the WSP:

Update-SPSolution –Identity [WSP file name] –LiteralPath [Physical path to WSP] –GACDeployment

The WSP is built using Visual Studio 2015.

Short-term solution is to copy the deleted safecontrol elements from a backup, but I don't want to keep having to do that. I checked the manifest.xml in the WSP file. All the safecontrols are there. Any idea why the safecontrols would disappear after a WSP deployment?

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.