I am trying to create a custom actions using wsp builder, My folder structure is something like this,

enter image description here

Now when I try to deploy solution nothing comes up however I get this error in my ULS log,

Failed to create a control from assembly '', class '': The control with assembly name '', ' class name '' is not allowed for web at URL ''. The type is not registered as safe.

I removed assembly names myself, however I read this another question they asking to add manifest.xml file but not sure where it will go and whether creating a wsp using wsp builder will include manifest.xml in wsp and will solve the problem ?

  • manifest.xml is created on the fly by wspbuilder when you build the wsp, so even if you add it to the project it will be removed as its used then deleted by wspbuilder! The type is not registered as safe means you need to add code that will register it as safe in the web.config
    – Ali Jafer
    Nov 8, 2012 at 9:26

2 Answers 2


You can add an empty Module to your project, open properties window and set Safe Control Entities property of a new added module. This property allows to add collection of safe controls.

  • thanks but isn't what you suggested works for SharePoint 2010 solutions only ? Nov 7, 2012 at 10:20
  • sorry, I missed your tag "2007". Yes the module is a feature of a project tamplate for Sharepoint 2010. I don't remember how this issue can be resolved in SharePoint 2010... But it looks like this post can be helpful.
    – Alexander
    Nov 7, 2012 at 16:23
  • making changes to web config manually isn't recommended neither comes in best practices tho :) Nov 7, 2012 at 16:28
  • that why the "Deploy the assembly using a solution package" is the best choise. Because in this approach config modifications are made by SharePoint deployment script.
    – Alexander
    Nov 7, 2012 at 18:00
  • ahh I see but thats what happening here, I got a wsp built by wsp builder and deployed using wsp builder as well Nov 7, 2012 at 18:44

you need to add this to the featureActivated function for feature recivers

        SPWebConfigModification safeControl = new SPWebConfigModification();
                    safeControl.Path = "configuration/SharePoint/SafeControls";
                    safeControl.Owner = ModuleNameGoesHere;
                    safeControl.Name = "SafeControl[@Assembly='assembly.Name.goes.Here, Version=, Culture=neutral, PublicKeyToken=87b3480442bff091'][@Namespace=Namespace.Name.goes.Here'][@TypeName='*'][@Safe='True']";
                    safeControl.Type = SPWebConfigModification.SPWebConfigModificationType.EnsureChildNode;
                    safeControl.Sequence = 0;
                    safeControl.Value = "<SafeControl Assembly='assembly.Name.goes.Here, Version=, Culture=neutral, PublicKeyToken=87b3480442bff091' Namespace=Namespace.Name.goes.Here' TypeName='*' Safe='True' />";

the code above adds the the feature or whatever it maybe to the safe controls in web.config for you! this is the recommended way and abides by best practices. So when you activate the feature it will add the safe controls :)


more can be found here similar to the example above! and yes this is best practice and was put inplace by microsoft specificaly for registering safecontrols without you manually doing it and it automatically gets added every time you activate the feature on the required web.config thats within the webapplication so no need to do it manualy multiple times :) :

A collection of web.config modifications is a set of commands that, when processed by the web.config manipulator in Microsoft SharePoint Foundation, change the state of the web.config file. You can string together a set of these commands to ensure that they apply the desired tags and attributes within web.config. Each modification is expressed as an object in the administrative object model.

Use the WebConfigModifications property of the SPWebApplication or SPWebService class to get the collection of web.config modifications either in the Web application or in all Web applications within the Web service. To apply modifications that you define through the SPWebConfigModification class to the web.config files in the server farm, call the ApplyWebConfigModifications method on the current content Web service object, as follows: SPWebService.ContentService.ApplyWebConfigModifications


hope it helps :)


If its a webpart then yes you should have a manifest file called manifest.xml with the following:

<?xml version="1.0" encoding="utf-8" ?>
<Solution xmlns="http://schemas.microsoft.com/sharepoint/" SolutionId="{C1938CC9-A1A3-4e20-932C-33ECB2C47481}">
    <Assembly DeploymentTarget="GlobalAssemblyCache" Location="WebPartsname.dll">
        <SafeControl Assembly="namespacegoeshere, Version=, Culture=neutral, PublicKeyToken=918d2ffdab83e9e8"
                     Namespace="namespacegoeshere" TypeName="*" Safe="True"/>

hope it sheds some light :)

  • yes but its not best practice is it Nov 9, 2012 at 14:11
  • ? ofcorse it is, its parts of SPWebConfigModification class which is a part of Microsoft.SharePoint.Administration namespace. Microsoft added it in specifically for that reason! :) check this out if you will: msdn.microsoft.com/en-us/library/…
    – Ali Jafer
    Nov 9, 2012 at 16:10
  • oh sorry I thought you were asking to make modifications manually, but I already added above code in my app.config but its not working Nov 9, 2012 at 16:49
  • you shouldnt put the above code in the app.config but rather in the feature activated in wspbuilder. check this out :) michaelbowersox.com/2009/05/10/feature-receiver-basics
    – Ali Jafer
    Nov 9, 2012 at 16:52
  • why not in app.config, I saw one of my workmate doing it, whats wrong with it Nov 9, 2012 at 16:53

Your Answer

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

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