tags:

views:

878

answers:

2

hi

I am getting the Following Error Could not load file or assembly 'Microsoft.SharePoint.Search, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c' or one of its dependencies. An attempt was made to load a program with an incorrect format,

Though I have added the required Share point refernece and also modified the project setting , set the CPU as Any CPU.

still the error is coming. kindly help

A: 

YOu are trying to use an x86 version of the dll instead of the x64 version or vice versa probably.

Colin
now i corrected that CPu thing , now the error is slightly modified,Could not load file or assembly Project name , Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c' or one of its dependencies. An attempt was made to load a program with an incorrect format
Azra
The problem lies in that you are somehow mixing x86 and x64 dll's, that's what the "An attempt was made to load a program with an incorrect format" means. Check your references to sharepoint and / or third party dll's to see if any of them are x64 builds....
Colin
A: 

Are you developing on a 64bit machine for WSS3 or MOSS 2007? If so, you will run into these problems, and Microsofts recommendation is to switch to a 32bit machine for development, but you can still deploy to a 64bit machine with no issues.

http://stackoverflow.com/questions/909274/how-should-i-create-a-good-environment-for-net-development-for-sharepoint/910292#910292

Moo