We have a solution structure like:
Both Project 1 and Project 2 are using the Project 3 output dll for some functionality. Everything was working fine on SharePoint 2010 with .NET 3.5 (every project).
Now we have to migrate to SharePoint 2013 means we have to compile now with .NET 4.5 and its new Security Level (no more CAS etc.)
The problem is that the Sandboxed Solution can not activate its feature because of errors like:
"Namespace.Method" is security transparent, but is a member of a security critical type.
Is it not possible to use a common library in sandboxed solution anymore?
I tried to use the SecuritySafeCritical / SecurityCritical / AllowPartiallyTrust attributes and features but no combination could resolve the problem. (No more CAS in 4.5)
In the assemplyInfo.cs file add the line:
[assembly: AllowPartiallyTrustedCallers]
Deploy the Sandbox solution and then the Farm solution. Since both are referring your dll, the farm will successfully update the dll.