Urgent: SafeControl Entry not done

Dec 9, 2008 at 8:37 PM

I am using WSPBUILDER's latest version to deploy my business logic dll to GAC. GAC deployment works fine but Safe Control Entry is not done in WEB.CONFIG. 

All I am doing is just compiling my project and XCOPY dll from bin folder to GAC folder. Then using wspbuilder creates wsp file and deploy the solution. Solution deployment is done properly and dll is deployed in GAC but web.config safe entry is not done.

- Again I am developing event handlers and trying to deploy using WSPBUILDER. For this I have created a feature and have 12 hive structure in my VS solution. Again, this solution, when deployed, copy the dll to GAC but does not update web.congif for safe control entry.

Its kind of urgent. I would really appreciate if anybody has any solutions to this problem

Dec 16, 2008 at 1:25 PM

What you need to do is create  set of folder "80\BIN" under WSPBuilder Project and xcopy your dlls to that folder. By doing this, WSPBuilder will add safe controls entry to web.config.
Hope this helps!..

Cheers, Puru
Jan 9, 2009 at 4:46 AM
Edited Jan 9, 2009 at 4:48 AM
Hey guys,

I'm having the same problem. The assembly I want to deploy to the GAC doesn't get a SafeControl element in the generated manifest.xml in the generated .wsp file.
Therefore, when I try to use stsadm to deploy my solution (stsadm -o deploysolution -name TelephoneBookList.wsp -local -allcontenturls -allowGacDeployment), I get

 This solution contains no resources scoped for a Web application and cannot be deployed to a particular Web application.

If I follow your advice ptr, WSPBuilder will generate the CAS policy in the manifest file, and the assembly will go to the Web-Application BIN directory instead of the GAC.

Is there a way to get WSPBuilder to add this SafeControl tag for an assembly to be deployed to the GAC?

Many thanks in advance

Best regards,
 Dinesh Bolkensteyn
Jan 12, 2009 at 4:20 AM
I have even added a WSPBuilder.exe.config in my project directory (same dir as my WSP and as solutionid), with:

    <add key="IncludeAssemblies" value="true" />
    <add key="BuildSafeControls" value="true" />

If I add

    <add key="WSPName" value="test.wsp" /> and build from Visual Studio, then it generates a file test.wsp , so this WSPBuilder.exe.config file is *NOT* ignored.

However, even with those 2 lines, I still get a .wsp file with my .dll in the root, my feature xml/aspx files, but no SafeControls in the Manifest.xml file !

All I have is:

    <Assembly Location="myproject.dll" DeploymentTarget="GlobalAssemblyCache" />

I just don't get it.

Do I have to place my .cs source files in any specific directory or ?

BTW, I am using the latest version of WSPBuilder for Visual Studio (here is the build output to confirm it):
========== Build: 1 succeeded or up-to-date, 0 failed, 0 skipped ==========
Created by Carsten Keutmann
GPL License 2007
Building the solution - please wait
Saving the Manifest.xml file
Creating the WSP file

Many thanks

Jan 12, 2009 at 8:13 AM
Okay, solved it !

Actually, my project was a little bit buggy .. It was partially relying on VSeWSS and partially on WSPBuilder (I was converting that project from VSeWSS to WSPBuilder).

I had to delete the Properties\Attributes.cs files (in the VSeWSS namespace,  thanks to the Reflector for showing me that), and the way the Event Handler was bound to the class (instead of using TargetList of VSeWSS, I switched to a feature:).

<?xml version="1.0" encoding="utf-8" ?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <Receivers ListTemplateId="105">
      <Assembly>MyNamespace, Version=, Culture=neutral, PublicKeyToken=b533abc4425fga</Assembly>

A single Event Receiver does not need to deploy anything to the web application. Hence, it can be deployed without -url or -allContentUrls. However, when you activate the feature, since the feature is scoped to the Web, you will have to set an -url.

Hope it will help some others