I need to add the ContentEditorWebPart in the list of SafeControls because of this. Unless there's a better way...

The problem is, I don't want to add it manually, i want to do this automatically when I deplou my solution.

So I tried adding my safe control to the .spdata of the module requiring this, like this:

<SafeControls> <SafeControl Assembly="Microsoft.SharePoint, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c" Namespace="Microsoft.SharePoint.WebPartPages" TypeName="ContentEditorWebPart" Safe="True" /> </SafeControls>

but when I check my web.config, it changes the assembly to my projects assembly..

And if I add it to my package, i have to deploy the Sarepoint dll with it.

So What is the best way to add it to the SafeControls?


Two options here:

Create a separate WSP that only applies this safecontrol node.

This WSP would be crafted by hand (manually creating DDF file and running with makecab), as even WSPBuilder wouldn't handle this too well.

Another reason why Visual Studio 2010 isn't that great (it's automation is good but not very clever).

Use WebConfigModification

Follow the info here on how to modify web.config automatically from code (possibly from FeatureInstalled). http://msdn.microsoft.com/en-us/library/bb861909.aspx

Personally I'd go for the second option, fewer WSPs = easier solution management overall.

  • Thx for the hint, i'll go with webConfigModification in a feature receiver – moi_meme Apr 7 '11 at 17:26

We use PowerShell to copy the web.config files in place when we deploy the WSP's and the web configs do include the safe controls that we want to have. We keep the config separate and in SVN so when the release is built this is added in separate and copied in separate along with the WSPS.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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