Could not load file or assembly

Khan, Saiful 0 Reputation points
2024-02-23T22:50:06.8433333+00:00

Error while building dotnet project.

Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\Common7\IDE\CommonExtensions\Microsoft\NuGet\NuGet.targets(169,5): error : Could not load file or assembly 'Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=XXXXXX' or one of its dependencies. The system cannot find the file specified
Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
5,026 questions
Visual Studio Setup
Visual Studio Setup
Visual Studio: A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.Setup: The procedures involved in preparing a software program or application to operate within a computer or mobile device.
1,031 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Michael Taylor 53,396 Reputation points
    2024-02-23T22:54:02.2266667+00:00

    This is insufficient information. Please provide more details such as whether this is a new project or existing one, one version of VS you're using, what version of NET you're targeting, what kind of project it is, etc. NewtonSoft is a Nuget package so you need to ensure you are importing that package (and version) using NuGet Package Manager inside VS. If you're using the old packages.config approach then you need to ensure that file is available. If you have updated your project then you need to ensure the package is still compatible and probably update to the newer package.

    0 comments No comments

  2. Pinaki Ghatak 3,830 Reputation points Microsoft Employee
    2024-02-24T21:28:54.23+00:00

    Hello Khan, Saiful

    It seems like your project is unable to find the Newtonsoft.Json assembly with version 13.0.0.0. This could be due to a few reasons:

    1. The specified assembly is not installed in your project. You can install it via NuGet package manager in Visual Studio or by using the Package Manager Console:
    Install-Package Newtonsoft.Json -Version 13.0.0
    

    The assembly is installed but the version is different from 13.0.0.0. You can check the version of Newtonsoft.Json in your project and update it if necessary.

    The assembly is not correctly referenced in your project. Check the .csproj file or packages.config file in your project to ensure that the reference is correct.

    If you’re working in a team, it’s possible that the assembly exists on a team member’s machine but not on yours. In this case, you should ensure that all necessary packages are included in your source control.

    If this is not what you are looking for, please provide more details.


    If this information provided here helps solve your issue, please tag this as answered, so it helps further community readers, who may have similar questions.

    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.