Link to home
Start Free TrialLog in
Avatar of hqdev
hqdevFlag for Canada

asked on

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=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.

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??
Thanks
Avatar of Ramkisan Jagtap
Ramkisan Jagtap
Flag of Finland image

Please check the with Sharepoint DLL, please add it as a reference to your project.
regards,
Ram
Avatar of hqdev

ASKER

Has I said in my message, I already have the sharepoint dll for reference and that's what is causing the problem!
Avatar of Shaun Kline
What about the Microsoft.SharePoint.Sandbox DLL? Your error message is complaining about it.
Avatar of hqdev

ASKER

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.
Avatar of hqdev

ASKER

My app is 3.5, I knew about the framework issue
ASKER CERTIFIED SOLUTION
Avatar of hqdev
hqdev
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of hqdev

ASKER

Found my own solution