Unhandled exception of type "System.IO.FileNotFoundException" in VkNet.dll

Additional information: Could not load file or assembly "Newtonsoft.Json, Version = 4.5.0.0, Culture = neutral, PublicKeyToken = 30ad4fe6b2a6aeed" or one of their dependencies. Cannot find the specified file.

This error pops up when trying to get all the photos of the user.

private void button1_Click(object sender, EventArgs e) { var getAll = vk.Photo.GetAll(Convert.ToInt32(textBox1.Text), true, 20, 0, true, false); foreach (var photos in getAll) { textBox1.Text = photos.CreateTime.ToString(); } } 

Tell me, please, what's the problem? Login is successful.

  • one
    Nevertheless it is written - the assembly file is missing, i.e. DLL from JsonNet. Check that this DLL is located in the folder next to the executable file of your program and in the assembly settings in the project it is indicated to copy it into the output directory. - rdorn

1 answer 1

Library VkNet.dll apparently requires a library Newtonsoft.Json.dll. Install Json.NET via nuget or add the link to the project manually. You can also add the dll itself to the project, in the properties specify "Copy to output directory - Copy later version" and "Assembly action - no"

  • I downloaded Json.NET directly, from the Net45 folder Net45 added a dll to the project, the error remained, only slightly different .. Additional information: Failed to load the file or assembly "Newtonsoft.Json, Version = 4.5.0.0, Culture = neutral, PublicKeyToken = 30ad4fe6b2a6aeed" or one of their dependencies. The found assembly manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) - Maxim
  • @ Maksim Why don't you try using nuget? - RusArt
  • I tried, asked to update nuget (click on the link, download), as a result of the installation it says: "SignatureDescription could not be created for the specified signature algorithm", so I wanted to manually .. - Max
  • 2
    @Maxim Make sure that the .NET version and the bitness set in the project match the version of .NET and the bitness for Newtonsoft.Json.dll - RusArt
  • one
    @FoggyFinder, yes, it turns out that NuGet can be updated via "Tools -> Extensions and Updates .." and then through NuGet I already downloaded VkNet normally. True, now throws an exception VkNet.Exception.AccessTokenInvalidException , but this is with the code something .. - Max.