I recently ran into an issue related to source generation in dotnet
when using the FastEndpoints.Generator
package.
The short story is that the version of the package I was using required a specific version of the Roslyn compiler yet my codebase was pulling in an older one.
Looking through the transitive nuget packages, I found the Microsoft.CodeAnalysis.CSharp
package and, indeed, it was an older version.
I needed to know which top-level nuget package was pulling this. Visual Studio, unfortunately, does not offer this information through its nuget management UI.
After some internet searching, I found a dotnet-tool
called depends
(Github Repo) which provides a nice TUI to explore a project’s (or a solution’s) nuget libraries, their dependencies, and dependents.
Installation is simple:
dotnet tool install --global dotnet-depends
Then I navigated to my src
folder in a terminal session and ran:
dotnet depends ./my-solution-file.sln
From there, it was a matter of finding the nuget package in the list, selecting it, and looking at the Reverse Depends
list.
Turns out the CMS version the project was on was pulling the older version 😬