R – WSPBuilder, Config Store and partially trusted callers

sharepointwspwspbuilder

Has anyone used WSP Builder to package a solution that uses the Config Store (http://www.codeplex.com/SPConfigStore) and deploys to the bin directory of the web application?

When I try to referecne the config store in my code behind file I get this exception…

System.Security.SecurityException: That assembly does not allow partially trusted callers

I've added the partially trusted callers attribute to my project

[assembly: AllowPartiallyTrustedCallers()]

and the sharepoint permissions attributes on my methods

[SharePointPermissionAttribute(System.Security.Permissions.SecurityAction.Demand, Impersonate = true)] 
[SharePointPermissionAttribute(System.Security.Permissions.SecurityAction.Demand, ObjectModel = true)]

But this hasn't seem to have done anything, I've also specified a custom CAS policy with the correct IPermission

<IPermission class="Microsoft.SharePoint.Security.SharePointPermission, Microsoft.SharePoint.Security, version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" version="1" ObjectModel="True" UnsafeSaveOnGet="True" Unrestricted="True" />

And still no success, surely other people have done this, I must be missing something

I'm using WSP Builder version 1.0.5.

Best Answer

You have added the [assembly: AllowPartiallyTrustedCallers()] to YOUR assembly, so your assembly WILL allow for partially trusted callers to call IT. But the ConfigStore itself does not have that attribute.

Is it possible to add your DLL to the GAC? (easy way out). Or add the [assembly: AllowPartiallyTrustedCallers()] to the ConfigStore project as well..