Dependify.Cli 1.4.0

There is a newer version of this package available.
See the version list below for details.
dotnet tool install --global Dependify.Cli --version 1.4.0                
This package contains a .NET tool you can call from the shell/command line.
dotnet new tool-manifest # if you are setting up this repo
dotnet tool install --local Dependify.Cli --version 1.4.0                
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=Dependify.Cli&version=1.4.0                
nuke :add-package Dependify.Cli --version 1.4.0                

Dependify

Build NuGet contributionswelcome Conventional Commits License

Dependify is a tool to visualize dependencies in your .NET application. You can start dependify in serve mode to visualize dependencies in a browser or use the CLI if you prefer the terminal.

Package Version Description
Dependify.Cli Nuget CLI
Dependify.Core Nuget Core library
Dependify.Aspire.Hosting Nuget Aspire support

Install

dotnet tool install -g Dependify.Cli
❯ dependify -h
USAGE:
    Dependify.Cli.dll [OPTIONS] <COMMAND>

EXAMPLES:
    Dependify.Cli.dll graph scan ./path/to/folder --framework net8
    Dependify.Cli.dll graph show ./path/to/project --framework net8

OPTIONS:
    -h, --help    Prints help information

COMMANDS:
    graph
    serve <path>

Usage

dependify serve $dev/path-to-folder/

You will see something like the following output in the terminal.

serve-terminal

Features

  • Workbench ⚙️
  • Dependency Explorer 🔎

Workbench gives you high level overview of the dependencies in the solution.

<video src="https://github.com/user-attachments/assets/e3eecf59-864d-4a7b-9411-60ee7a364c57" controls="controls"> </video>

You can open the mermaid diagram right in the browser.

serve-graph-view

Dependency Explorer allows you to select the dependencies you want to see.

<video src="https://github.com/user-attachments/assets/555df3ef-b0c3-4354-911f-81d4dfd07607" controls="controls"> </video>

Aspire support

You can add Dependify.Web as resource to your Aspire project.

Add the package to AppHost:

dotnet add package Dependify.Aspire.Hosting

Register via IDistributedApplicationBuilder. Add the following code to your Program.cs:

var builder = DistributedApplication.CreateBuilder(args);

var apiService = builder.AddProject<Projects.aspire_project_ApiService>("apiservice");

builder.AddProject<Projects.aspire_project_Web>("webfrontend")
    .WithExternalHttpEndpoints()
    .WithReference(apiService);

builder.AddDependify().ServeFrom("../../aspire-project/"); // <-- location of .sln file

builder.Build().Run();

See the samples/aspire-project for more details.

CLI

You can use the CLI for the automation or if you prefer the terminal.

dependify graph --help
USAGE:
    dependify graph [OPTIONS] <COMMAND>

EXAMPLES:
    dependify graph scan ./path/to/folder --framework net8
    dependify graph show ./path/to/project --framework net8

OPTIONS:
    -h, --help    Prints help information

COMMANDS:
    scan <path>    Scans for projects and solutions and retrives their dependencies
    show <path>    Shows the dependencies of a project or solution located in the specified path

The command scan will scan the folder for projects and solutions and retrieve their dependencies. The ouput can be in tui or mermaid format. The tui or terminal user interface is the default output format.

dependify graph scan $dev/keycloak-authorization-services-dotnet/

tui-demo1

Here is how to change the output format to mermaid.

dependify graph scan \
    $dev/keycloak-authorization-services-dotnet/ \
    --exclude-sln \
    --format mermaid \
    --output ./graph.md
graph LR
    Keycloak.AuthServices.Authentication.csproj:::project
    Keycloak.AuthServices.Templates.csproj:::project
    Blazor.Server.csproj:::project
    GettingStarted.csproj:::project
    AuthorizationGettingStarted.csproj:::project
    AuthorizationAndCleanArchitecture.csproj:::project
    Blazor.Client.csproj:::project
    TestWebApi.csproj:::project
    Keycloak.AuthServices.Authorization.csproj:::project
    Keycloak.AuthServices.Common.csproj:::project
    TestWebApiWithControllers.csproj:::project
    Keycloak.AuthServices.Sdk.csproj:::project
    WebApp.csproj:::project
    Keycloak.AuthServices.Sdk.Tests.csproj:::project
    AuthGettingStarted.csproj:::project
    Keycloak.AuthServices.Common.Tests.csproj:::project
    Keycloak.AuthServices.Authentication.Tests.csproj:::project
    Keycloak.AuthServices.Aspire.Hosting.csproj:::project
    ResourceAuthorization.csproj:::project
    Keycloak.AuthServices.OpenTelemetry.csproj:::project
    Keycloak.AuthServices.Authorization.Tests.csproj:::project
    Keycloak.AuthServices.IntegrationTests.csproj:::project
    Keycloak.AuthServices.Sdk.Kiota.csproj:::project
    Blazor.Shared.csproj:::project
    Keycloak.AuthServices.IntegrationTests.csproj --> Keycloak.AuthServices.Sdk.csproj
    Keycloak.AuthServices.Common.Tests.csproj --> Keycloak.AuthServices.Common.csproj
    AuthGettingStarted.csproj --> Keycloak.AuthServices.Authorization.csproj
    ResourceAuthorization.csproj --> Keycloak.AuthServices.OpenTelemetry.csproj
    Keycloak.AuthServices.Authorization.Tests.csproj --> Keycloak.AuthServices.Authentication.csproj
    AuthGettingStarted.csproj --> Keycloak.AuthServices.Sdk.csproj
    Keycloak.AuthServices.Authorization.csproj --> Keycloak.AuthServices.Common.csproj
    WebApp.csproj --> Keycloak.AuthServices.Authorization.csproj
    GettingStarted.csproj --> Keycloak.AuthServices.Authentication.csproj
    ResourceAuthorization.csproj --> Keycloak.AuthServices.Sdk.Kiota.csproj
    WebApp.csproj --> Keycloak.AuthServices.Common.csproj
    Keycloak.AuthServices.Sdk.Kiota.csproj --> Keycloak.AuthServices.Common.csproj
    AuthorizationGettingStarted.csproj --> Keycloak.AuthServices.Authentication.csproj
    Keycloak.AuthServices.Authorization.Tests.csproj --> Keycloak.AuthServices.Authorization.csproj
    ResourceAuthorization.csproj --> Keycloak.AuthServices.Authentication.csproj
    Keycloak.AuthServices.Authorization.Tests.csproj --> Keycloak.AuthServices.Common.csproj
    Keycloak.AuthServices.IntegrationTests.csproj --> Keycloak.AuthServices.Sdk.Kiota.csproj
    Keycloak.AuthServices.Sdk.csproj --> Keycloak.AuthServices.Common.csproj
    Blazor.Client.csproj --> Blazor.Shared.csproj
    Blazor.Server.csproj --> Blazor.Shared.csproj
    Keycloak.AuthServices.Authentication.Tests.csproj --> Keycloak.AuthServices.Authentication.csproj
    Blazor.Server.csproj --> Keycloak.AuthServices.Authentication.csproj
    AuthorizationAndCleanArchitecture.csproj --> Keycloak.AuthServices.Authentication.csproj
    AuthorizationGettingStarted.csproj --> Keycloak.AuthServices.Authorization.csproj
    Keycloak.AuthServices.Authentication.csproj --> Keycloak.AuthServices.Common.csproj
    Keycloak.AuthServices.Sdk.Tests.csproj --> Keycloak.AuthServices.Sdk.csproj
    ResourceAuthorization.csproj --> Keycloak.AuthServices.Authorization.csproj
    Keycloak.AuthServices.IntegrationTests.csproj --> Keycloak.AuthServices.Authentication.csproj
    AuthorizationGettingStarted.csproj --> Keycloak.AuthServices.Sdk.csproj
    ResourceAuthorization.csproj --> Keycloak.AuthServices.Common.csproj
    ResourceAuthorization.csproj --> Keycloak.AuthServices.Sdk.csproj
    Blazor.Server.csproj --> Blazor.Client.csproj
    Blazor.Server.csproj --> Keycloak.AuthServices.Authorization.csproj
    TestWebApi.csproj --> Keycloak.AuthServices.Authorization.csproj
    AuthGettingStarted.csproj --> Keycloak.AuthServices.Authentication.csproj
    AuthorizationAndCleanArchitecture.csproj --> Keycloak.AuthServices.Authorization.csproj
    Keycloak.AuthServices.Authentication.Tests.csproj --> Keycloak.AuthServices.Common.csproj
    Keycloak.AuthServices.IntegrationTests.csproj --> TestWebApi.csproj
    TestWebApiWithControllers.csproj --> Keycloak.AuthServices.Authorization.csproj
    Keycloak.AuthServices.IntegrationTests.csproj --> Keycloak.AuthServices.Authorization.csproj
    AuthorizationAndCleanArchitecture.csproj --> Keycloak.AuthServices.Sdk.csproj
    WebApp.csproj --> Keycloak.AuthServices.Authentication.csproj
    Keycloak.AuthServices.IntegrationTests.csproj --> Keycloak.AuthServices.Common.csproj
    Keycloak.AuthServices.IntegrationTests.csproj --> TestWebApiWithControllers.csproj
    classDef project fill:#74200154;
    classDef package fill:#22aaee;

API

You can use the API to build your own tools.

dotnet add package Dependify.Core
var services = new ServiceCollection()
    .AddLogging()
    .AddSingleton<ProjectLocator>()
    .AddSingleton<MsBuildService>();

var provider = services.BuildServiceProvider();

var locator = provider.GetRequiredService<ProjectLocator>();
var msBuildService = provider.GetRequiredService<MsBuildService>();

var nodes = locator.FullScan("C:\\Users\\joel\\source\\repos\\Dependify");

var solution = nodes.OfType<SolutionReferenceNode>().FirstOrDefault();

var graph = msBuildService.AnalyzeReferences(solution, MsBuildConfig.Default);

var subgraph = graph.SubGraph(n => n.Id.Contains("AwesomeProjectName"));

Build and Development

dotnet cake --target build

dotnet cake --target test

dotnet cake --target pack

dotnet tool install --global --add-source ./Artefacts Dependify.Cli --prerelease

dotnet tool uninstall Dependify.Cli -g

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

Version Downloads Last updated
1.7.0 394 8/13/2024
1.6.0 114 8/12/2024
1.5.1 128 8/9/2024
1.5.0 106 8/8/2024
1.4.0 71 8/3/2024
1.3.0 70 8/2/2024
1.2.0 60 7/31/2024
1.1.0 86 7/28/2024
1.0.1 125 7/22/2024
1.0.0 99 7/21/2024
0.1.1 101 7/20/2024
0.1.0 104 7/20/2024

The release notes are available at https://github.com/NikiforovAll/dependify