1

I have a WCF service that uses the DLL : Microsoft.Sharepoint

When I deployed it to the server that does not have SharePoint installed on it then I got the below error :

Could not load file or assembly 'Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c' or one of its dependencies

Can anyone help me with this issue ?

1
  • What are you trying to do in this web service? There is a good chance that even with those DLLs, your application won't work. Microsoft.SharePoint assemblies require to be executed on the SharePoint server (that's why it's called Server Side Object Model). Cinsider using CSOM instead. Aug 30, 2015 at 13:14

2 Answers 2

3

Since you seem to get a lot of not so great answers on this question:

You can not use the Server Object Model outside of the SharePoint farm. This means that you can not use the Microsoft.SharePoint.dll.

Instead you need to use the Client Object Model (CSOM). So you need to convert your code (rewrite it) to CSOM and instead of the Microsoft.SharePoint.dll, reference the Microsoft.SharePoint.Client.dll

1
  • Thanks for your answer . for solving my issue I make a another web service that has the original one as a client and call the functions . This does not require any SharePoint dependencies Sep 4, 2015 at 9:14
-2

In you WCF service project in Visual Studio, click expand References in the project select the reference to Microsoft.SharePoint and open the Properties dialog and on the property Copy Local select True.

Then the DLL will be included in the project when being built.

1
  • 3
    To not much help if the wcf is not run on the SharePoint servers. In this situation we need to use the Client dlls Aug 30, 2015 at 11:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.