Having trouble adding safe controls to manifest.xml

Mar 20, 2008 at 7:43 PM
I've been using the WSP builder for some time and have never had this come up before...

For some reason, when i run wspbuilder.exe on my project, the assembly that is in the GAC folder is not getting a safe control entry in the generated manifest.xml for the solution. The <Assembly> entry gets added to the manifest.xml file, but it doesn't get a safe control entry.

Like all my other projects, i have the WSPBuilder.exe.config file set up with Cleanup set to false, and a specified output directory.

I've tried messing with the config file and no matter what i do, i can't get the safe control to be added to the manifest.xml file.

The assembly that's in the GAC folder is nothing special... just a single public class that's derived from Microsoft.SharePoint.WebControls.LayoutsPageBase, and that one of my _layouts pages inherits from.

Any help is appreciated

- John
Apr 2, 2008 at 8:08 PM
Ditto. I and another developer are working on the same VSS controlled project - he gets a SafeControls entry (pointing inexplicably to a non-existant namespace); I get no SafeControls entry at all...
Coordinator
Apr 11, 2008 at 12:28 PM
Try the WSPBuilder version 0.9.8.0408.
The assembly reflection have been rewritten.

/keutmann
May 7, 2008 at 1:28 AM
0.9.8.0408 seems to have solved the problem... Thanks!!!
Jun 3, 2008 at 3:19 AM
It looks like an assembly must have a reference to an SP dll to get a SafeControls entry in manifest.xml.
Is there a way to force a dll in the GAC folder to get a SafeControls entry?
Coordinator
Jun 13, 2008 at 8:58 AM
Remember!
You classes have to be public and inherit from WebControl / WebPart.
Only classes that can be used directly on ASP.NET pages needs to be declared by a SafeControl tag.
Jun 18, 2008 at 11:32 AM
Edited Jun 18, 2008 at 11:41 AM
While this sort the problem with webparts you develop yourself. add it does not sove another problem

I am using the a webpart from the Microsoft.Office.InfoPath.Server.Controls namespace which is not in the safecontrol tags by default, XmlFormView 

I know its possible to make a feature which add a safecontroltag to the web.config file by using SPWebConfigModification class in the sharepoint namespace.

However it would be very much in the spirit of sharepoint developement if I was able to add the safecontrol tag to the manifest.xml file. Is there any way to acomplish this with wspbuilder?
Coordinator
Jun 26, 2008 at 5:22 PM
The WSPBuilder ignores the Microsoft dll's when creating the SafeControls tags.
However if you inherit from any webpart class in your own code, then the WSPBuilder should pickup your webpart class (must be public) and add a SafeControl tag in the manifest.xml file.
If this do not solve your problem please specify your project in more detail.
Be sure to use the WSPBuilder ver. 0.9.8.0406.
Feb 26, 2009 at 4:50 AM
I have written a custom webpart, and in the wsp built manifest.xml file, the SafeControl entry does appear, but a safecontrol entry is not made in the web.config file of my web application when the solution is deployed.
Please tell me if i am missing soemthing. thanks
Jul 22, 2010 at 6:38 PM
keutmann wrote:
Remember!
You classes have to be public and inherit from WebControl / WebPart.
Only classes that can be used directly on ASP.NET pages needs to be declared by a SafeControl tag.

Are you sure this is right? I'm building a solution package for a Receiver and WSPBuilder isn't generating the SafeControl I need to target deployment at specific web applications. See the proposed answer from Paul Lucas on the SharePoint Forum thread Deploy solution to a Web Application scope for more detail on the requirement.