VS - How to fix "Could not load file or assembly 'Newtonsoft.Json, Version=13.0.0.0"

Jocelyn Kwong 0 Reputation points
2025-01-31T11:58:33.4366667+00:00

Hi,

I have created a new SSIS project in Visual Studio, and there is a Script Task built in the SSIS package. This Script Task is used get a bearer token from an API website, this C# script run successfully in C# Console.

When I run the Script Task component in the SSIS package, I always get the error message (see below).

I could see the 'Newtonsoft.Json.13.0.1' has installed in the script package, so I don't know what's wrong on my laptop setting.

How could I resolve this problem?

Here below is the Environment Information.

Version of Visual Studio: Microsoft Visual Studio Professional 2019 (Version 16.11.42)

Version of NET: Microsoft .NET Framework Version 4.8.09.37

Version of Target SQL Server: Microsoft SQL Server 2016

Inside the Script Task Editor (VSTA), I have installed the following NuGet packages.

a) Install Microsoft.AspNet.WebApi.Client 6.0.0, included

  • Newtonsoft.Json.13.0.1
  • Newtonsoft.Json.Bson.1.0.2
  • System.Buffers.4.5.1
  • System.Runtime.CompilerServices.Unsafe.4.5.3
  • System.Memory.4.5.5
  • System.Threading.Tasks.Extensions.4.5.4
  • Microsoft.AspNet.WebApi.Client.6.0.0

b) Install the Microsoft.CSharp 4.7.0, included

  • Microsoft.CSharp.4.7.0

Error Message: -

Error: 0x0 at Get Bearer Token, Script Task: Error: Could not load file or assembly 'Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The system cannot find the file specified.

Many thanks.

Best regards,

Jocelyn

SQL Server Integration Services
SQL Server Integration Services
A Microsoft platform for building enterprise-level data integration and data transformations solutions.
2,639 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. ZoeHui-MSFT 40,131 Reputation points
    2025-02-03T03:15:26.75+00:00

    Hi @Jocelyn Kwong,

    Install the assembly

    Open a command prompt in administrator mode. This may prompt the UAC dialog to pop and you might need to use admin credentials depending on your security set up.

    Installation to the GAC is straight-forward after that.

    "C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\gacutil.exe"
    

    /if signals Install and Force a re-install even if the assembly already exists.

    If I wanted to install the newtonsoft dll from above, that syntax would be

    "C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\gacutil.exe" /if "C:\Users\bfellows\AppData\Local\Temp\vsta\SSIS_ST140\VstatIBdQdlmHEa__RFeT36Nd9A\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll"

    Kindly check below links to see if it is helpful.

    https://stackoverflow.com/questions/65632495/could-not-load-file-or-assembly-ssis-script-task

    https://github.com/JamesNK/Newtonsoft.Json/issues/2574

    Regards,

    Zoe Hui


    If the answer is helpful, please click "Accept Answer" and upvote it.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.