find_unused_project_references

[architecture]

Tests each direct ProjectReference by removing it in memory and checking whether new compiler errors appear in the referencing project. Use it for compile-backed project cleanup planning.

Try this tool in Playground.

Parameters

NameTypeRequiredDescription
projectNamestringNoOptional project name to limit analysis to one referencing project.
maxEvidenceDiagnosticsnumberNoMaximum compiler diagnostics to include as evidence for a used reference. Default is 5. Use 0 to omit samples.

Examples

Analyze all direct project references

Request
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "find_unused_project_references",
    "arguments": {}
  }
}
Response
{
  "success": true,
  "data": {
    "projectCountAnalyzed": 1,
    "totalReferencesAnalyzed": 3,
    "unusedReferenceCount": 1,
    "items": [
      {
        "projectName": "MyProject.Web",
        "referenceProjectName": "MyProject.Legacy",
        "referencePath": "../MyProject.Legacy/MyProject.Legacy.csproj",
        "canRemove": true,
        "evidenceDiagnostics": []
      }
    ]
  },
  "error": null
}

Analyze one project with no evidence samples

Request
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "find_unused_project_references",
    "arguments": {
      "projectName": "MyProject.Web",
      "maxEvidenceDiagnostics": 0
    }
  }
}
Response
{
  "success": true,
  "data": {
    "projectCountAnalyzed": 1,
    "totalReferencesAnalyzed": 3,
    "unusedReferenceCount": 1,
    "items": [
      {
        "projectName": "MyProject.Web",
        "referenceProjectName": "MyProject.Legacy",
        "referencePath": "../MyProject.Legacy/MyProject.Legacy.csproj",
        "canRemove": true,
        "evidenceDiagnostics": []
      }
    ]
  },
  "error": null
}

Response Notes

Returns direct project references that appear removable, plus evidence when a reference is still required