unable to create asp.net application referencing microsoft.sharepoint

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 asp.net.
I start a new asp.net 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??
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Ramkisan JagtapLead DeveloperCommented:
Please check the with Sharepoint DLL, please add it as a reference to your project.
hqdevAuthor Commented:
Has I said in my message, I already have the sharepoint dll for reference and that's what is causing the problem!
Shaun KlineLead Software EngineerCommented:
What about the Microsoft.SharePoint.Sandbox DLL? Your error message is complaining about it.
Active Protection takes the fight to cryptojacking

While there were several headline-grabbing ransomware attacks during in 2017, another big threat started appearing at the same time that didn’t get the same coverage – illicit cryptomining.

hqdevAuthor Commented:
There's no such thing as a sharepoint.sandbox dll, it is part of sharepoint.dll.
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.
hqdevAuthor Commented:
My app is 3.5, I knew about the framework issue
hqdevAuthor Commented:
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.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
hqdevAuthor Commented:
Found my own solution
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.