Il seguente errore
Could not load file or assembly ‘Microsoft.Sharepoint.Sandbox, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c’ or one of its dependencies. An attempt was made to load a program with an incorrect format
mi è capitato referenziando una DLL di SharePoint (non sandbox) in un progetto di Visual Studio 2010.

La soluzione l'ho trovata in questo post Could not load the sandbox dll from the ASP.NET project e consiste nell'inserire un azione di Post-build event in Visual Studio per cancellare la suddetta DLL che viene erroneamente copiata:

DOS / Batch file

cd $(TargetDir)
del Microsoft.SharePoint.SandBox.dll 
Tags:
C#235 Errori120 SharePoint497 SharePoint 2010224 Visual Studio37
Potrebbe interessarti anche: