Could not load Assembly 'Microsoft.Office.Serv

2020-07-11 06:00发布

问题:

I have got following error:

"Could not load file or assembly 'Microsoft.Office.Server.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."

Does anybody know solution for this?

or

Does anybody gonn through this error?

Any input greatly appretiated?

回答1:

its too late to answer this question, anyway, just for any other who face the same issue, make sure that you are targeting "X64" Platform Target in Project Properties under "Build" tab, in my case i was creating a Win Forms Application.



回答2:

If you are convinced that the DLL file is on the server, you should try looking for it here:

C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\ISAPI\

From my experience with SharePoint, some DLL files can be found in the GAC whilst others were located in the above folder.

EDIT: If you're using SharePoint 2010, then change 12 to be 14 in the folder path.



回答3:

I was facing a similar issue--I was getting that exact error when trying to publish. My solution would build and run, but I couldn't publish the web project. I was not referencing Microsoft.Office.Server.Search in any project, but I was referencing Microsoft.Office.Server in four of them, which were in turn referenced by my web site project. Contrary to one previous answer, I am targeting Release - Any CPU and it hasn't caused any problems.

I went into each project that referenced Microsoft.Office.Server and set the Copy Local property to false for the Microsoft.Office.Server assembly. I was then able to build and publish. I then set Copy Local back to true for all of them and it built and published.