Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

256
Views
Could not load file or assembly Newtonsoft.Json in Docker container, ASP.NET 6

After updating to .NET 6 I get this error when running my ASP.NET app inside a Docker container:

An unhandled exception was thrown by the application.
System.IO.FileNotFoundException: Could not load file or assembly \u0027Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed\u0027. The system cannot find the file specified.  File name: \u0027Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed\u0027
at Cadmean.RPC.ASP.FunctionController.GetFunctionCall()
at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine]
...

Here is my Dockerfile:

FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build-env
WORKDIR /app

COPY . ./

RUN dotnet publish -c Release -o out

FROM mcr.microsoft.com/dotnet/aspnet:6.0
WORKDIR /app
COPY --from=build-env /app/out .
ENTRYPOINT ["dotnet", "DealCrackerBackend.dll"]

The library Newtonsoft.Json 13.0.1 is references from a different project (class library) in the solution. The referenced nuget package Cadmean.RPC is also using the same version of Newtonsoft.Json 13.0.1.

The app compiles and runs but when I make a request this happens.

The app works as before on macOS with .NET 6.0.100.

over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

I had the same issue and was also related to my unit test project. In my case, I'm using nUnit and it has Microsoft.NET.Test.Sdk version 17.1.0-preview and this references Newtonsoft.Json version 9, but all other projects have version 13. For now, just removed the unit test project from the solution

over 4 years ago · Santiago Trujillo Report

0

Apparently, the issue is related to Newtonsoft.Json package and net6 but only in Docker (Linux) environment. We replaced that with System.Text.Json and it was resolved.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!