2

This is the code which I used. And I have added Microsoft.SharePoint.dll .

using Microsoft.SharePoint.Client;
using System.Web.Script.Serialization;
using Microsoft.SharePoint;

    class
    {          
      SPSite site = new SPSite(siteUrl);
    }

The Error shows like this :

 Could not load file or assembly 'Microsoft.SharePoint, Version=15.0.0.0,
 Culture=neutral, PublicKeyToken=71e9bce111e9429c' or one of its dependencies. 
 The system cannot find the file specified.
SCramphorn
  • 447
  • 4
  • 23
Nikhilp Shaju
  • 23
  • 1
  • 7

1 Answers1

2

1) Check references in your project. Is there a Microsoft.SharePoint reference?

2) If there is a reference and it's not corrupted, check the version by opening library properties.

2.1) If you have referenced a newer version, add an assembly binding with bindingRedirect in app config, for example:

<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
  <dependentAssembly>
    <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-9.0.0.0" newVersion="9.0.0.0" />
  </dependentAssembly>
</assemblyBinding>

3) Enable the Fusion log How to enable assembly bind failure logging (Fusion) in .NET and read the logs.

  • Is it must to keep this file in in C:\Windows\Microsoft.NET\assembly\GAC_MSIL\Microsoft.SharePoint.Client.Runtime\v4.0_15.0.0.0__71e9bce111e9429c\Microsoft.SharePoint.Client.Runtime.dll – Nikhilp Shaju Jul 19 '17 at 13:56