There’s one specific error that keeps coming back when I create new SharePoint solutions that require multiple assemblies next to the farm/sandboxed solution.
[FileNotFoundException: Could not load file or assembly 'XXXXXX, Version=184.108.40.206, Culture=neutral, PublicKeyToken=fac8624abc8c03c2' or one of its dependencies.The system cannot find the file specified.] XXXX.Page_Load(Object sender, EventArgs e) +0 System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +25 System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +42 System.Web.UI.Control.OnLoad(EventArgs e) +132 Microsoft.SharePoint.WebControls.UnsecuredLayoutsPageBase.OnLoad(EventArgs e) +101 Microsoft.SharePoint.WebControls.LayoutsPageBase.OnLoad(EventArgs e) +49 System.Web.UI.Control.LoadRecursive() +66 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2428
In this case an application page references code from another DLL that is not part of the SharePoint assembly. To fix this problem, you’ll have to indicate in the SharePoint solution that there are other assemblies that need to be included too.
Therefore, you need to navigate to your SharePoint solution in Visual Studio and open up the package.package file. Select the ‘Advanced’ tab and click ‘Add’. Depending on your situation you can choose to add assemblies that are part of the Visual Studio solution or those who aren’t. If you choose the former, the first combobox will provide a list of projects from your Visual Studio solution. Select the project of your choice and click OK.
If you are working with safe controls for instance, you’ll need to provide the details here too. If you deploy once again, you’ll see the error message has disappeared and you’ll have a working application page. This is a fairly simple scenario, but chances are high that your assembly uses other assemblies too. In that case you’ll need to include those in the package.package file.