Got the following error, when I used the SharePoint dll in an ASP.NET project. VS2010 puts the sandbox assembly into the bin folder automatically.
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.
To fix the error, just delete the sandbox dll from the bin folder directly, but it is just temporary solution, VS2010 will create the dll again each time you do a build.
The final solution for me is to add the following commands to the Post – build event command line of the Build Events for this project.
cd $(TargetDir)
del Microsoft.SharePoint.SandBox.dll
June 27th, 2012 at 7:18 am
Thank you! this post really helped me!!!!
July 20th, 2012 at 6:07 am
I was getting this error after converting a standard web site from VS2008 to VS2010. I guess the conversion module just assumed it should be SharePoint. That’s really confusing. Your post saved the day.
August 6th, 2012 at 10:01 pm
Thank you
August 8th, 2012 at 8:22 am
Awesome…Thanks this help me with this dumb issue.
August 29th, 2012 at 10:15 pm
thank u sir, thank very much finally its working
September 12th, 2012 at 2:39 am
While this works, I see it more as a workaround rather than a fix… Does anyone know why it’s happening?? I really like to get to the bottom of this…
September 21st, 2012 at 11:20 pm
saved my day !!!
October 8th, 2012 at 8:41 am
Unfortnately this is not a solution. It only gets you past the error. I agree that MS needs to fix this instead of asking their customers to patch their bugs.
October 30th, 2012 at 11:01 pm
Thank you