-1

Could not load file or assembly Newtonsoft.Json or one of its dependencies. The parameter is incorrect.

11:41:39: Server Error in '/' Application.

I have tried solving it with the solutions from the similar queries but was unable to solve this error.

Could not load file or assembly 'Newtonsoft.Json' or one of its dependencies. The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG))

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.IO.FileLoadException: Could not load file or assembly 'Newtonsoft.Json' or one of its dependencies. The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG)) An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Assembly Load Trace: The following information can be helpful to determine why the assembly 'Newtonsoft.Json' could not be loaded.

Jim Hewitt
  • 1,726
  • 4
  • 24
  • 26
Mohammed
  • 11
  • 3
  • 1
    From all, the only I could guess is you don't have dll in reference...You are getting this while building the application or during execution? – A3006 Oct 20 '16 at 06:21
  • The exception message is pretty clear. Check if Newtonsoft.dll exists in your executable folder ("bin" usually) – Fabio Oct 20 '16 at 06:21
  • i've checked , Newtonsoft.dll already exists in bin folder, this error im facing is while the execution of the code. – Mohammed Oct 20 '16 at 06:23
  • 1
    Possible duplicate of [Could not load file or assembly ... The parameter is incorrect](http://stackoverflow.com/questions/8269386/could-not-load-file-or-assembly-the-parameter-is-incorrect) – Adrian Sanguineti Oct 20 '16 at 06:27
  • @adrian I have already tried from the above link, but it wont work, can u pls provide a diff solution. – Mohammed Oct 20 '16 at 06:29
  • @Mohammed, please state everything you have already tried in the body of the question. – Adrian Sanguineti Oct 20 '16 at 06:49

2 Answers2

0

Are you deploying your app using an installer? Don't forget to update your installer script to include Newtonsoft.Json.dll in the list of installed files.

Phillip Ngan
  • 15,482
  • 8
  • 63
  • 79
  • no, im not using any installer, can u tell me what kind of installed u are referring to ? Thanks – Mohammed Oct 20 '16 at 06:24
  • I was checking to see whether your situation was that you were trying to run your app after it was installed by an installer. However this doesn't sound like the case. – Phillip Ngan Oct 20 '16 at 06:58
0

Try uninstalling the package and reinstalling it again

Uninstall-Package Newtonsoft.Json -Force

Then

Install-Package Newtonsoft.Json

Midhun Murali
  • 2,089
  • 6
  • 28
  • 49
  • can u pls tell me how i can uninstall the package Newtonsoft.Json – Mohammed Oct 20 '16 at 06:26
  • When im trying to update JSON , its showing an error : "The schema version of 'Newtonsoft.Json' is incompatible with version 2.0.30625.9003 of NuGet. Please upgrade NuGet to the latest version from http://go.microsoft.com/fwlink/?LinkId=213942" – Mohammed Oct 20 '16 at 06:28
  • open the nuget package manager console and type the uninstall command mentioned above – Midhun Murali Oct 20 '16 at 06:28
  • First execute this command Uninstall-Package Newtonsoft.Json -Force – Midhun Murali Oct 20 '16 at 06:28
  • Uninstallation done, but when i m entering the installation code, this error pops up : Install-Package : The schema version of 'Newtonsoft.Json' is incompatible with version 2.0.30625.9003 of NuGet. Please upgrade NuGet to the latest version from http://go.microsoft.com/fwlink/?LinkId=213942. At line:1 char:1 + Install-Package Newtonsoft.Json + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [Install-Package], InvalidOperationException + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand – Mohammed Oct 20 '16 at 06:34
  • Well that error tells you exactly what you need to do: Upgrade NuGet. So have you? – Adrian Sanguineti Oct 20 '16 at 06:35
  • Please install the latest version of nuget package manager as its mentioned – Midhun Murali Oct 20 '16 at 06:36
  • The error message tells you exactly what to do upgrade. Follow the link. – Adrian Sanguineti Oct 20 '16 at 06:38
  • select the Tools > Extensions and Updates command and click on the Updates tab to see if a new version of the Package Manager is available – Midhun Murali Oct 20 '16 at 06:40
  • appreciate ur help guys, but im Unable to open that link :( – Mohammed Oct 20 '16 at 06:40
  • Try from VS ,, Tools > Extensions and Updates command and click on the Updates – Midhun Murali Oct 20 '16 at 06:41
  • There was new version of package manager, and i downloaded it but during the installation it shows installation failed – Mohammed Oct 20 '16 at 07:00
  • The error is "The process cannot access the file because it is being used by another process" but it is not opened anywhere – Mohammed Oct 20 '16 at 07:01
  • Close all VS instance and do it once again – Midhun Murali Oct 20 '16 at 07:58