1

Background:

I am building a MVC3 project in C# that calls up a SharePoint project to request data. Both projects will live on the same server, but in separate app pools.

Problem:

After adding the necessary references to SP, I can get my MVC project to build correctly; however, when I debug, I get this error:

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

I have referenced the 'Microsoft.SharePoint.Search' dll, but still no luck.

Any ideas? Many thanks!

Matt Cashatt
  • 23,490
  • 28
  • 78
  • 111

2 Answers2

0

Did you try "copy local" on the SP dlls. Are both application pools have exactly the same settings? .Net version, 64/32 bit?

Akos Lukacs
  • 2,007
  • 1
  • 16
  • 21
0

MVC3 requires .NET 4.0 but SharePoint 2007 does not support running under .NET 4.0

You can't bridge this gap so you're not going to be able to use the SharePoint object model - instead look into the SharePoint web services.

If the web services don't give you everything you need then you may have to create some of your own (running under the SharePoint app) and call them from your MVC3 app

http://msdn.microsoft.com/en-us/library/bb862916(v=office.12).aspx

Community
  • 1
  • 1
Ryan
  • 23,871
  • 24
  • 86
  • 132