# Nuget

### How to replace a Nuget package

1\. Open your project's `.csproj` file.

2\. If the vulnerability is in a direct dependency, replace the existing version in the `<PackageReference>` element (the following example is `Newtonsoft.Json@12.02`):

```xml
  <ItemGroup>
    <PackageReference Include="Newtonsoft.Json" Version="12.0.2-sp1" />
  </ItemGroup>
```

3\. If the vulnerability is in a transitive dependency, add an explicit `<PackageReference>` to pin it to the sealed version:

```xml
  <ItemGroup>
    <PackageReference Include="Newtonsoft.Json" Version="12.0.2-sp1" />
  </ItemGroup>
```

{% hint style="warning" %}
The dotnet tool might generate a false warning that the sealed version is vulnerable.

It is safe to ignore this warning.

```
warning NU1903: Package 'Newtonsoft.Json' 12.0.2-sp1 has a known high severity vulnerability, https://github.com/advisories/GHSA-5crp-9r3c-p9vr
```

{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.sealsecurity.io/fundamentals/artifact-server/editing-your-dependencies/nuget.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
