unable to create application referencing microsoft.sharepoint

Posted on 2011-10-04
Last Modified: 2012-05-12
Hi experts,
I need to create an ASP.NET application to read and write SharePoint lists.
I can do it with an executable but I've failed to do it with
I start a new project, just write "Hello world" in a div, add a reference to Microsoft.Sharepoint.
When I start the apps I get the following message:
Could not load file or assembly 'Microsoft.Sharepoint.Sandbox, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c' or one of its dependencies. An attempt was made to load a program with an incorrect format.

This message normaly says something about a wrong target CPU for one of the Dlls, I've tried every CPU with no success.

I'm using VS 2010 on SharePoint Enterprise 2010, I am SharePoint farm admin.
I develop locally on the server itself.

Any ideas, how to resolve that problem??
Question by:hqdev
    LVL 12

    Expert Comment

    by:Ramkisan Jagtap
    Please check the with Sharepoint DLL, please add it as a reference to your project.

    Author Comment

    Has I said in my message, I already have the sharepoint dll for reference and that's what is causing the problem!
    LVL 25

    Expert Comment

    by:Shaun Kline
    What about the Microsoft.SharePoint.Sandbox DLL? Your error message is complaining about it.

    Author Comment

    There's no such thing as a sharepoint.sandbox dll, it is part of sharepoint.dll.
    LVL 5

    Expert Comment

    To use the sharepoint dll you need to target the .net framework 3.5 the sharepoint dll does not work with the framework 4
    May be this is your problem.

    Author Comment

    My app is 3.5, I knew about the framework issue

    Accepted Solution

    Finnaly I found that we have to use the SharePoint client object model.
    So using microsoft.sharepoint.client instead of microsoft.sharepoint and changinf the code did the trick.
    The coding is significatly different but it work well.


    Author Closing Comment

    Found my own solution

    Featured Post

    Do You Know the 4 Main Threat Actor Types?

    Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

    Join & Write a Comment

    Summary In SharePoint 2010 it is easy to create custom color themes to jazz up a site. Theme colors can also be created in PowerPoint 2010 with a few clicks. But how do the chosen colors actually look in the SharePoint site? The attached PowerPoint…
    International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
    This video discusses moving either the default database or any database to a new volume.
    In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor ( If you're interested in additional methods for monitoring bandwidt…

    730 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now