Answer why a package or assembly is in a legacy or SDK-style C# solution, which projects reference an assembly, and where versions and binding redirects conflict, from a read-only dependency graph of the solution's project files. Use it when asked why a package is referenced, what pulls a dependency in, which projects use an assembly, or whether versions or binding redirects disagree, and not to restore, build, or change references.
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Dotnet Dependencies?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/ejryan89-dotnet-dependencies)
---
name: dotnet-dependencies
description: "Answer why a package or assembly is in a legacy or SDK-style C# solution, which projects reference an assembly, and where versions and binding redirects conflict, from a read-only dependency graph of the solution's project files. Use it when asked why a package is referenced, what pulls a dependency in, which projects use an assembly, or whether versions or binding redirects disagree, and not to restore, build, or change references."
argument-hint: "<why <name>...|where <assembly>|conflicts|graph> [--project <path>]"
allowed-tools: ["Bash({{PYTHON}} -B \"${CLAUDE_SKILL_DIR}/scripts/dependency_graph.py\" *)", "PowerShell({{PYTHON}} -B \"${CLAUDE_SKILL_DIR}/scripts/dependency_graph.py\" *)"]
---
Answer a dependency question about the .NET solution in the current directory from its project files alone. One script builds the graph and answers every query; it reads `.sln`, `.slnx`, `.csproj` and the files a project imports, `Directory.Build.props` and `Directory.Packages.props` among them, `packages.config`, each package's `.nuspec`, `obj/project.assets.json`, `web.config`, and `app.config`, runs no restore or build, and changes nothing but the file `graph` writes. Each line it prints is one tab-separated fact; its docstring names every line. Act on the printed lines, not the exit code: a query that reports a conflict or an unreadable file also exits 1. A last line `FAILED <reason>` means stop and report the reason.
## 1. Choose the query from the question
| The user asks | Run |
|---|---|
| Why is this package or assembly here, what pulls it in | `why <name> [<name> ...]` |
| Everything one project depends on, direct and transitive | `why --all --project "<project>"` |
| Which projects use this assembly, and through what | `where <assembly>` |
| Do versions or binding redirects disagree, is an upgrade safe | `conflicts` |
| A diagram of the solution's dependencies | `graph` |
Run the chosen query from the solution's directory, adding `--root "<solution or directory>"` when the solution is elsewhere or the directory holds more than one, and `--project "<project>"` to narrow any query to one project:
```bash
{{PYTHON}} -B "${CLAUDE_SKILL_DIR}/scripts/dependency_graph.py" why "<name>"
```
Pass the names as the user wrote them; matching ignores case. A name may be a package id or an assembly name. Never run `ask_sdk.py` on your own; section 2 says when to ask.
## 2. Read the answer
- `PATH <project> <frameworks> <name> <source> <chain>` is one chain from the project to the name. `<frameworks>` names the restore's target frameworks that hold the line, joined by `;`, a runtime-specific target as `<framework>/<runtime>`, such as `net8.0/win-x64`, or `-` for a project with no restore; a name reached under one framework or runtime only, through a package, assembly, or project reference that holds for it alone, is labelled with it. `source` says who answered: `graph` is the script's own walk of the project files and the restore's assets file, and `sdk` is `dotnet nuget why`, asked only through `ask_sdk.py` (below). Below a project reference, the packages are those the restore of the project the chain starts from resolves, which it builds with, and a package or project the referenced project marks private is walked on that project's own restore; a hop `<name> (v<version>, graph v<other>)` is one the referenced project's own restore resolves at `<other>` instead, several joined by `;`. `conflicts` reports that split.
- `SDK_NOT_ASKED <project> <reason>` means the walk may not have read the restore's assets file MSBuild reads for a project whose packages the answer reads: the project moves it through a property the script cannot settle, so the walk read the one in `obj/` if any, which may not be the one the build uses, or where the walk does not read it, such as outside the examined tree, so the walk read none, the project reads `direct`, and an `UNREADABLE` line before it names the file and why. Every query prints it. Report the line with the answer, and say that what the answer shows through that project's packages may not be the build's, or misses its transitive packages. A reason holding `the SDK is asked only by why <name>` names a project this query does not ask the SDK about; when the question turns on a name, offer what follows for `why "<name>" --project "<project>"` with that project. A reason ending `ask_sdk.py ran, but dotnet is not installed` means the query already ran through `ask_sdk.py` and found no `dotnet`, so the SDK could not be asked: report that dotnet is not installed, and do not offer `ask_sdk.py` again. Otherwise the reason ends with what `ask_sdk.py` would do: ask the user in chat whether to rerun the query through `ask_sdk.py`: it has `dotnet nuget why` locate the file, which lets MSBuild and the .NET host read and run whatever the project and the machine's SDK configuration lead them to, beyond the examined tree, so it suits a repository the user trusts. Only on their yes, run the same `why` names and options, which the runtime asks the user to approve, since no grant covers it: `{{PYTHON}} -B "${CLAUDE_SKILL_DIR}/scripts/ask_sdk.py" "<name>"`. `SDK_FAILED <project> <name> <reason>` means the SDK was asked through `ask_sdk.py` and failed, even after printing part of an answer; the walk answered that project, and a reason ending `which may not be the one the build uses` means it answered from the restore in `obj/`, so say the answer may not be the build's. An `UNREADABLE` line right after a project's first `SDK_FAILED` line names that project's assets file, which the walk does not read, for each such project, though several share the file, such as one outside the examined tree, so the walk answered the project from its project file alone and misses its transitive packages. `MISSING <name>` means no project reaches the name: check the spelling against a `PROJECT` line's project before concluding it is unused.
- `TRUNCATED <project> <frameworks> <name> <limit>` means that project reaches the name through more chains than the limit, and only the first `<limit>` were printed as `PATH` lines. Say the answer for that project and name is capped at that limit; never present the printed chains as all of them.
- `REACHES <project> <frameworks> <name> <version> <kind> <first hop>` answers `why --all`: one line per package, project, assembly, or framework the project reaches, with the direct reference that brings it in. `WHERE <project> <frameworks> <assembly> <kind> <version> <via>` answers `where`: one project whose references resolve to the assembly, how, and through what. `WROTE <file> <nodes> <edges>` answers `graph`: give the user the file's path. `SUMMARY` closes every query with its counts: for `why`, chains printed, names found, and names missing; for `why --all`, items reached; for `where`, projects; for `conflicts`, names in conflict and stale redirects; for `graph`, nodes and edges.
- `CONFLICT <name> <kind> <version> <project> <frameworks> <via>` lines come in groups of two or more versions of one name. A split between projects means the build picks one assembly at run time and the others' callers may fail with a missing-method or load error; a split inside one project, direct against transitive, is the same risk on one project. Two frameworks of one project build apart, so a version split between them alone is not a conflict. `REDIRECT_STALE` names a binding redirect whose `newVersion` is not an assembly version the project references, so the redirect sends callers to a version that is not there; `REDIRECT_UNREFERENCED` names a redirect for an assembly the project no longer references, which is clutter rather than a fault.
- `UNREADABLE <file> <reason>` means that file's facts are missing from every line after it, never that the answer is wrong elsewhere. Report the file and the reason with the answer, and say the answer is partial for the projects that file belongs to; an unreadable solution file lists no project, so the answer is empty because of it. A reason naming a condition, or a name the script cannot settle, says what it did instead for the framework it names: an item left out, an `Update`, a `Remove`, or a metadata value such as a `Version` not applied. A reason naming an `Import` means the file it names was not read, so the properties after it are unsettled. A reason naming an item inside a `Target` means that item, which MSBuild adds only when the target runs, is missing from every framework. A file refused for a `DOCTYPE` or `ENTITY` declaration is one the script will not parse by design; the user fixes the file, not the script. A reason `<link> is a link to <target>, outside the examined tree <tree>, ...` means a symbolic link or junction on the file's way, or the file itself, leads outside the tree, so the file was neither read nor stat, by design; say which link and where it leads. `more than 40 links lie on the way to it, ...` and `<link> is a link whose target cannot be read: ...` mean the same file was not read because its links could not be followed inside the tree. A reason `the entry is a junction or a symbolic link that leads outside the examined tree, ...` is the search for projects passing over a link it does not follow, folder or file, since telling which would follow it; any projects behind it are missing. Report it with the answer, which stands for every project the search reached, and say the run exits 1 because of the line, not because the answer failed; to have what lies behind the link searched, the user replaces the link with what it points at, or reruns with `--root` at the folder it leads to. A file link leading outside that the script also reads, such as a linked `Directory.Packages.props` or `packages.config`, is named twice, once by the search and once by the read; both mean the one link.
- Each `PROJECT` line's third field says where a project's package-to-package edges came from: `assets` (a restore), `nuspec` (the packages folder or the NuGet cache), or `direct` (neither was found, so only the references the project file states are known). When a question turns on a transitive chain and the project reads `direct`, say so and suggest a restore, unless an `SDK_NOT_ASKED` or `SDK_FAILED` line names the project, either meaning the walk could not place or read the restore's assets file MSBuild reads for it, so its restore may exist where the walk does not look: say that instead, or its `PATH` lines are `sdk`, which `dotnet nuget why` answered from its restore. The first line, `ROOT <solution or directory>`, names what was read; when it is not the solution the user meant, rerun with `--root`. A directory holding no solution, inside a checkout or not, is searched for `.csproj` files, passing over hidden folders, and the search stops after 10000 folders: an `UNREADABLE` line whose reason names the bound means that folder and every folder after it were not searched; rerun with `--root` at the solution or the folder holding the projects. A `--project` the search did not reach is not read: `FAILED <project> lies in <folder>, which the search for projects under <directory> does not enter: <reason>; ...` names the folder it passes over, and `FAILED <project> lies past the search for projects under <directory>, which stopped at <folder>: <reason>; ...` the bound; rerun with `--root` at that project's solution or folder. A `--project` that a link or `..` leads out of the tree is no project of the root; one named outside the tree, through a link above it, or with its own `..` leaving the tree before a link has its folders on the way read for their metadata and listed, with a case-swapped name's metadata read in each, to learn whether they compare names by case, never a file read. `FAILED <root> cannot be examined: <reason>`, with a reason naming a link, means the root folder's solution, or the solution or folder `--root` names, lies through a link inside the checkout that leads out of it, and was not read; name its real place with `--root`. A link above every checkout, such as macOS's `/var`, is followed. A `..` after a link or after a name that is not there, in `--root` or `--project`, is judged as Linux and macOS take it, so on Windows a path the system would take by name can be refused; have the user name the path without the `..`.
## 3. Report
Answer the question in the user's terms from the lines, naming the projects and the versions. Quote a chain as the `PATH` line shows it. Do not edit a project file, `packages.config`, or a config file to resolve what you found: say what would resolve it and let the user decide.