Could not load file or assembly 'Microsoft.SharePoint.Library' which I've never added

Sean Dooley picture Sean Dooley · Jul 31, 2017 · Viewed 11.6k times · Source

I've been developing a .NET Web Application that connects with a SharePoint Online instance. Everything was going well until I suddenly started getting the following error

Could not load file or assembly 'Microsoft.SharePoint.Library, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c' or one of its dependencies. The system cannot find the file specified.

This is a file or assembly that I have never added into the project. I've only added the following SharePoint packages via NUGET

  • JohnHolliday.Caml.Net.SharePoint
  • SharePoint.Client
  • SharePoint.Client.Runtime
  • SharePoint.Client.Search

Any help would be greatly appreciated.

UPDATE

Installed SharePoint Server 2013 Client Components SDK which includes the following

Microsoft.Office.Client.Education.dll
Microsoft.Office.Client.Policy.dll
Microsoft.Office.Client.TranslationServices.dll
Microsoft.SharePoint.Client.dll
Microsoft.SharePoint.Client.DocumentManagement.dll
Microsoft.SharePoint.Client.Publishing.dll
Microsoft.SharePoint.Client.Runtime.dll
Microsoft.SharePoint.Client.Search.Applications.dll
Microsoft.SharePoint.Client.Search.dll
Microsoft.SharePoint.Client.Taxonomy.dll
Microsoft.SharePoint.Client.UserProfiles.dll
Microsoft.SharePoint.Client.WorkflowServices.dll

Unfortunately, no Microsoft.SharePoint.Library.

UPDATE

Finally resolved the issue. There was a SharePoint.dll in the bin folder of the project that once deleted, the project was able to run as normal.

Answer

Nino picture Nino · Jul 31, 2017

Some of libraries you added, such as SharePoint.Client are dependant on Microsoft.SharePoint.Library

Installing Sharepoint client components should remove that error. Download it from here