I am using a third party library in my SharePoint 2010 Visual Web Part sand box solution.
I have already added the assembly to the Package using the Advance tab as instructed here https://msdn.microsoft.com/en-us/library/vstudio/ee231595(v=vs.120).aspx
I then use Visual Studio 2013 to deploy it to my local farm.
If I set Deployment Target to WebApplication
Error 2 Error occurred in deployment step 'Add Solution': This solution contains invalid markup or elements that cannot be deployed as part of a sandboxed solution. Solution manifest for solution '54d81981-d8ba-4eca-96a7-a766b4b7fbd1' failed validation, file manifest.xml, line 4, character 65: The 'DeploymentTarget' attribute is invalid - The value 'WebApplication' is invalid according to its datatype 'http://schemas.microsoft.com/sharepoint/:SolutionDeploymentTargetType'
If I choose GlobalAssemblyCache, it works but upon running the web part, this error is thrown
An exception of type 'System.IO.FileLoadException' occurred in CustomFormBuilder.dll but was not handled in user code Additional information: Could not load file or assembly 'KellermanSoftware.NET-SFTP-Library, Version=4.5.0.0, Culture=neutral, PublicKeyToken=dccbd7ce7d6a58c0' or one of its dependencies. Failed to grant minimum permission requests. (Exception from HRESULT: 0x80131417)
Full exception
System.IO.FileLoadException was unhandled by user code Message=Could not load file or assembly 'KellermanSoftware.NET-SFTP-Library, Version=4.5.0.0, Culture=neutral, PublicKeyToken=dccbd7ce7d6a58c0' or one of its dependencies. Failed to grant minimum permission requests. (Exception from HRESULT: 0x80131417) Source=CustomFormBuilder
FileName=KellermanSoftware.NET-SFTP-Library, Version=4.5.0.0, Culture=neutral, PublicKeyToken=dccbd7ce7d6a58c0 StackTrace: at CustomFormBuilder.VisualWebPart1.VisualWebPart1.Upload() at CustomFormBuilder.VisualWebPart1.VisualWebPart1.ConfirmBtn_OnClick(Object sender, EventArgs e) at System.Web.UI.WebControls.LinkButton.OnClick(EventArgs e) at System.Web.UI.WebControls.LinkButton.RaisePostBackEvent(String eventArgument) at System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
InnerException: System.Security.Policy.PolicyException Message=Required permissions cannot be acquired. Source=mscorlib StackTrace: at System.Security.SecurityManager.ResolvePolicy(Evidence evidence, PermissionSet reqdPset, PermissionSet optPset, PermissionSet denyPset, PermissionSet& denied, Boolean checkExecutionPermission) at System.Security.SecurityManager.ResolvePolicy(Evidence evidence, PermissionSet reqdPset, PermissionSet optPset, PermissionSet denyPset, PermissionSet& denied, Int32& securitySpecialFlags, Boolean checkExecutionPermission) InnerException: