0

I created an ASP.net webapplication and i have used assemblies Microsoft.SharePoint; and Microsoft.Office.Server.UserProfiles in it.. i get a run time error

"Could not load file or assembly 'Microsoft.Sharepoint.Sandbox' or one of its dependencies. An attempt was made to load a program with an incorrect format. "

in it.

How to resolve this?

3 Answers 3

1

From microsoft and i agree, you need the correct version from the gac and reference it into your project. Once you add the reference you need to set "copy to local" as false ;)

this will work and what i would do if i ran into any dll issue!

step by step:

To copy the dll, goto start - select or search for "run" and copy past this code:

%windir%\assembly\GAC_64\Microsoft.Sharepoint.Sandbox\14.0.0.0__71e9bce111e9429c

run

add reference to your project, right click on the reference Microsoft.SharePoint.Sandbox.dll and click on "properties" set copy to local = false

dll copy to loacal = false

build and run project, should work fine :)

http://blogs.technet.com/b/sharepointdevelopersupport/archive/2012/07/24/building-silverlight-solution-with-ria-service-enabled-fails-on-sharepoint-2010-sp1-environments.aspx

0

According to this blog post by Louis Liang, the workaround is to add a post-build event and delete the DLL:

cd $(TargetDir)
del Microsoft.SharePoint.SandBox.dll

Taken from :

https://stackoverflow.com/questions/11435715/how-can-i-stop-microsoft-sharepoint-sandbox-dll-from-being-copied-into-my-bin-fo

0

If you created an ASP.NET Web Application that it going to run outside of SharePoint (i.e. on a different server or in a different App Pool on the same server), then you cannot use the assemblies you referenced. They are part of the Server Object Model and need to run in the context of SharePoint. For remote applications you need to use the Client Object Model (Microsoft.SharePoint.Client.*), the REST API, or the SOAP Web Services.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.