Code Monkey home page Code Monkey logo

dependensee's Introduction

DependenSee

Dotnet project and package dependency visualizer.


V3 Is Coming! ๐Ÿ”œ

I have started work on the next major version of DependenSee. See what's coming!


Install

Requires .NET 6 Runtime

dotnet tool install DependenSee --global

available on Nuget

Nuget Badge

Uninstall

dotnet tool uninstall DependenSee --global

Basic Usage

DependenSee root/of/projects path/to/output.html

See full CLI documentation

Sample Output (HTML, interactive)

Download this as html and open in a browser for a demo.

DependenSee sample html output

Why DependenSee over 'X'

Current popular options are to either use NDepend, VS Architecture Explorer or Code Map. While these options are feature rich, they also has a licensing cost. If all you want is to see the dependency graph, and nothing else, it may be hard to justify the licensing cost. Then DependenSee is for you.

If you need to see the Type structure, relationships between your methods or types .etc. then you should use one of the options above instead. DependenSee is mean to be very simple, easy, straight forward to use and FREE! DependenSee does not intend to compete with the above. See Limitations

Features

  • Creates the dependency graph for your solution.
  • Can only include or exclude certain namespaces so the result is not overwhelming or filled with noise.
  • Can create HTML, XML, JSON and Graphviz outputs
  • Can return output to STDOUT for further processing by other command line tools
  • Returns errors and warnings to STDERR

For full docs run without any arguments DependenSee

Privacy and Security Note

In the output, the full path to project files is used as the unique identifier. So your file structure is exposed in the generated output. It attempts to only use the subdirectory structure, so an attempt is made to hide the full path, however it is possible these paths may include your username for example, if your project was located in the default VS path/repo clone location of C:\Users\<username>\Repos\....

Keep this in mind and inspect the output if you're distributing the outputs from this tool.

Limitations

  • Currently only traverses csproj and vbproj files. No other file types are supported.
  • No compile results are inspected. Only the project structure is used.

License

MIT License

Support

If you are experiencing issues, please open an issue with details and reproduction steps.

Contributions

Pull requests welcome. โ™ฅ

Please branch off of dev branch and put a PR to dev for your changes. If you have a contribution you're not sure about, please feel free to open an issue. However a prior approval is not necessary for a PR to be merged.

Once approved, all pending changes (possibly multiple PRs) will be merged to main for a release to be distributed via NuGet.

Powered by (Thanks)

dependensee's People

Contributors

bdovaz avatar bstordrup avatar codebytes avatar jeffdoolittle avatar madushans avatar peterwurzinger avatar wurzingerringana avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

dependensee's Issues

[FEATURE] Make it available as nugget package

Is your feature request related to a problem? Please describe.
Currently I'm working on a project where we want to analyse the project dependencies. We would like to integrate this package in our console app so we can further analyse the depency graph of dependence. This not possible because Dependensee is currently only available as a dotnet tool in nugget.

Describe the solution you'd like
It would be nice if we could directly add this package to our project instead of using the tool.

Describe alternatives you've considered
Currently we copied this source code into our project. But we would like to directly reference this project and stay up to date.

[FEATURE] Target newer .NET runtimes

@madushans I am willing to create PR if you give me the go ahead.

Is your feature request related to a problem? Please describe.

I use the tool through CI and right now it requires that I have to install the .NET 6 runtime just for this tool (I am using .NET 7 and transitioning to .NET 8).

Describe the solution you'd like

The tool targets newer runtimes.

Describe alternatives you've considered

Install .NET 6 runtime.

Prevent nodes from overlapping

First of all, great project, thank you!

One small nitpick: Would you be able to modify the graph layout algorithm to don't make nodes overlap? In a large project with lot of dependencies there's a bit of manual shifting around needed to see the information.

For example, this solution will show this graph by default:
image

You have to pan the nodes around to make it more legible:
image

[BUG] ReferenceDiscoveryService.Discover breaks on NTFS junction points

Hey there,

Our .NET source code repository contains some front-end codes as well coming with pnpm package management which tends to use NTFS junction points to avoid node_modules folders. This causes the DependenSee discovery to fail when it hits a junction point.

Directory of $SOURCE\node_modules\.pnpm\@[email protected]\node_modules\@babel

2022-04-01  09:11 AM    <DIR>          .
2022-04-01  09:11 AM    <DIR>          ..
2022-04-01  09:11 AM    <JUNCTION>     parser [$SOURCE\node_modules\.pnpm\@[email protected]\node_modules\@babel\parser]
               0 File(s)              0 bytes

DependenSee Command
DependenSee . -P -O outputPath

DependenSee Output

System.IO.DirectoryNotFoundException:Could not find a part of the path '$SOURCE\node_modules\.pnpm\@[email protected]\node_modules\@babel\parser'.
   at System.IO.Enumeration.FileSystemEnumerator`1.CreateDirectoryHandle(String path, Boolean ignoreNotFound)
   at System.IO.Enumeration.FileSystemEnumerator`1.Init()
   at System.IO.Enumeration.FileSystemEnumerableFactory.UserFiles(String directory, String expression, EnumerationOptions options)
   at System.IO.Directory.InternalEnumeratePaths(String path, String searchPattern, SearchTarget searchTarget, EnumerationOptions options)
   at DependenSee.ReferenceDiscoveryService.Discover(String folder, DiscoveryResult result) in D:\a\1\s\DependenSee\ReferenceDiscoveryService.cs:line 61
   at DependenSee.ReferenceDiscoveryService.Discover(String folder, DiscoveryResult result) in D:\a\1\s\DependenSee\ReferenceDiscoveryService.cs:line 119
   at DependenSee.ReferenceDiscoveryService.Discover(String folder, DiscoveryResult result) in D:\a\1\s\DependenSee\ReferenceDiscoveryService.cs:line 119
   at DependenSee.ReferenceDiscoveryService.Discover(String folder, DiscoveryResult result) in D:\a\1\s\DependenSee\ReferenceDiscoveryService.cs:line 119
   at DependenSee.ReferenceDiscoveryService.Discover(String folder, DiscoveryResult result) in D:\a\1\s\DependenSee\ReferenceDiscoveryService.cs:line 119
   at DependenSee.ReferenceDiscoveryService.Discover(String folder, DiscoveryResult result) in D:\a\1\s\DependenSee\ReferenceDiscoveryService.cs:line 119
   at DependenSee.ReferenceDiscoveryService.Discover(String folder, DiscoveryResult result) in D:\a\1\s\DependenSee\ReferenceDiscoveryService.cs:line 119
   at DependenSee.ReferenceDiscoveryService.Discover() in D:\a\1\s\DependenSee\ReferenceDiscoveryService.cs:line 48
   at DependenSee.PowerArgsProgram.Main() in D:\a\1\s\DependenSee\PowerArgsProgram.cs:line 91
--- End of stack trace from previous location ---
   at PowerArgs.ObjectEx.InvokeMainMethod(Object o)
   at PowerArgs.Args.<>c__DisplayClass15_1.<InvokeMain>b__1()
   at PowerArgs.Args.Execute[T](Func`1 argsProcessingCode)
   at PowerArgs.Args.<>c__DisplayClass15_0.<InvokeMain>b__0(String[] a)
   at PowerArgs.REPL.DriveREPL[T](TabCompletion t, Func`2 eval, String[] args, Func`1 defaultEval)
   at PowerArgs.Args.InvokeMain(CommandLineArgumentsDefinition definition, String[] args)
   at PowerArgs.Args.InvokeMain[T](String[] args)
   at DependenSee.Program.Main(String[] args) in D:\a\1\s\DependenSee\Program.cs:line 19

DependenSee Version
2.1.0

[FEATURE] Project Wildcard Exclusion

It would be nice to generate diagrams that exclude folders/projects with a given wildcard parameter, such as:

  • **/*.Tests
  • **/*.Tests.csproj

This would enable a much simpler and cleaner view in repositories where the test projects live next to their implementations, rather than in a separate tests folder with a different project root.

[FEATURE] Visually isolate node of interest

I was excited to find this tool - it is quite helpful. Thanks for making it.

Is your feature request related to a problem? Please describe.
In a large workspace with many projects, what I see is many blue nodes and blue edges. When I click on a node, it and its edges are made bold. Although very useful, it's hard to use.

Describe the solution you'd like
It would be nice to have a way to isolate a node. Some ideas when clicking a node:

  1. it and its edges become bold as usual, but all other nodes and unrelated edges are muted (grey)
  2. incoming edges are one colour and outgoing edges are another
  3. best: both 1 and 2 simultaneously

Hope you'll consider it, and thank you!

[FEATURE] Specify HTML title on command line

This is a pretty simple request and I'm happy to submit a PR for it but wanted to talk to you about how best to go about it.

I would like to be able to specify the title used in HTML output from the command line. I'm currently going through a lot of projects trying to find dependencies and sometimes end up with multiple DependenSee HTML browser windows open and it would be helpful to be able to tell them apart more easily.

An option could be added such as -HT or -HtmlTitle where it defaults to "DependenSee" (current behavior) if not specified. The option could be ignored for mismatched output types, a warning displayed but output still generated, or an error + abort triggered.

My approach would be to add new constants in ResultWriter.cs for HtmlTitleToken and HtmlTitleDefault and then make the necessary updates in PowerArgsProgram.cs, Program.cs, ResultWriter.Write, and ResultWriter.WriteAsHtmlToFile to support passing the value through and applying it. The value would be appropriately escaped before being injected into the HTML output.

I also considered using something like AngleSharp to make the update since it's HTML but that seems like overkill as long as the value is being escaped properly.

I don't intend to modify XML, JSON, or GraphViz output as I am less familiar with their use cases and wouldn't want to make changes that could break anyone else's workflow.

I look forward to hearing your thoughts on this.

[BUG] Crash when running

Hey there,

Pull Requests are welcome. If you know how to add the bugfix to code and you're sure it fits well with the scope of DependenSee, feel free to branch off of dev and put a PR.

This template is here only if you're not sure if it really is a bug, if is in scope or you're not looking to contribute code/not know how to start.


Describe the bug
I got a crash when trying to run the tool

To Reproduce
Steps to reproduce the behavior:

Example VS Solution
If possible attach a zip of a solution directory that exepriences this issue.
DependenSee only looks at csproj files, so you don't have to include your code. But if you do, make sure you Clean your solution to prevent any anti malware software from flagging the upload.

DependenSee Command
dependensee . .\References.html

DependenSee Output
System.Xml.XmlException:Invalid character in the given encoding. Line 413, position 67.
at System.Xml.XmlTextReaderImpl.Throw(Exception e)
at System.Xml.XmlTextReaderImpl.Throw(String res, String arg)
at System.Xml.XmlTextReaderImpl.InvalidCharRecovery(Int32& bytesCount, Int32& charsCount)
at System.Xml.XmlTextReaderImpl.GetChars(Int32 maxCharsCount)
at System.Xml.XmlTextReaderImpl.ReadData()
at System.Xml.XmlTextReaderImpl.ParseAttributeValueSlow(Int32 curPos, Char quoteChar, NodeData attr)
at System.Xml.XmlTextReaderImpl.ParseAttributes()
at System.Xml.XmlTextReaderImpl.ParseElement()
at System.Xml.XmlTextReaderImpl.ParseElementContent()
at System.Xml.XmlTextReaderImpl.Read()
at System.Xml.XmlLoader.LoadNode(Boolean skipOverWhitespace)
at System.Xml.XmlLoader.LoadDocSequence(XmlDocument parentDoc)
at System.Xml.XmlLoader.Load(XmlDocument doc, XmlReader reader, Boolean preserveWhitespace)
at System.Xml.XmlDocument.Load(XmlReader reader)
at System.Xml.XmlDocument.Load(String filename)
at DependenSee.ReferenceDiscoveryService.DiscoverFileReferences(String path) in D:\a\1\s\DependenSee\ReferenceDiscoveryService.cs:line 142
at DependenSee.ReferenceDiscoveryService.Discover(String folder, DiscoveryResult result) in D:\a\1\s\DependenSee\ReferenceDiscoveryService.cs:line 88
at DependenSee.ReferenceDiscoveryService.Discover(String folder, DiscoveryResult result) in D:\a\1\s\DependenSee\ReferenceDiscoveryService.cs:line 135
at DependenSee.ReferenceDiscoveryService.Discover() in D:\a\1\s\DependenSee\ReferenceDiscoveryService.cs:line 44
at DependenSee.PowerArgsProgram.Main() in D:\a\1\s\DependenSee\PowerArgsProgram.cs:line 102
--- End of stack trace from previous location ---
at PowerArgs.ObjectEx.InvokeMainMethod(Object o)
at PowerArgs.Args.<>c__DisplayClass15_1.b__1()
at PowerArgs.Args.Execute[T](Func1 argsProcessingCode) at PowerArgs.Args.<>c__DisplayClass15_0.<InvokeMain>b__0(String[] a) at PowerArgs.REPL.DriveREPL[T](TabCompletion t, Func2 eval, String[] args, Func`1 defaultEval)
at PowerArgs.Args.InvokeMain(CommandLineArgumentsDefinition definition, String[] args)
at PowerArgs.Args.InvokeMain[T](String[] args)
at DependenSee.Program.Main(String[] args) in D:\a\1\s\DependenSee\Program.cs:line 15

=============================================================
|                                                           |
|                   Well that didn't work.                  |
|                                                           |
|   If this keeps happening,                                |
|     - try updating to the latest version with             |
|       - dotnet tool update DependenSee --global           |
|                                                           |
|     - check current version with                          |
|       - dotnet tool list --global                         |
|                                                           |
|     - Please open an issue at                             |
|       - https://www.github.com/madushans/DependenSee      |
|                                                           |
|              โ™ฅ Thank you for your support โ™ฅ               |
|                                                           |
=============================================================

DependenSee Version
Run dotnet tool list --global to get the installed version details
Package Id Version Commands

dependensee 2.2.0 DependenSee

[FEATURE] Mermaid output type

Problem

I would like to use a dependency tree diagram in Markdown documentation. GitHub and many other platforms and tools can render Mermaid diagrams out of the box, with no need to convert them into images manually.

Solution I'd like

New output type "Mermaid", such that I can paste it in GitHub Markdown documents or elsewhere.

Alternatives

Mermaid format is different enough from Graphviz DOT to discourage from manual conversion.
I can't find any readymade solution that would convert any DependenSee output to Mermaid diagram format.
I would like to avoid writing and supporting my own converter from DependenSee JSON to Mermaid.

Additional context

GitHub example - code and preview:

```mermaid
graph TD;
    A["Foo"]
    B["Bar"]
    A-->B;
    A-->C;
    B-->D;
    C-->D;
```
graph TD;
    A["Foo"]
    B["Bar"]
    A-->B;
    A-->C;
    B-->D;
    C-->D;

[FEATURE] Evaluate projects to investigate from solution file

When you have a repository folder where multiple solutions are in use, or you have a repository folder where some projects are not being used by the main solution, you get additional and not required projects to investigate for dependencies.

If a command line parameter specifying a list of solution file name, then these solution files could be used to evaluate which projects to analyze for dependencies. If not specified, behavior would be as today.

A command line parameter for using a single solution found in the source folder could trigger the same behavior for the single solution file in the folder. In case multiple solution files are found while this parameter is specified, the run should be aborted and an error reported back (something like "You asked to use a single solution file as root, but multiple solution files are found. Specify solution file as argument or run without this parameter")

Dependent nuget packages are not listed

tried with sample .net 5.0 project, added newtonsoft.json as dependency, built but

PS C:\git\.Azure> DependenSee.exe -s .\ConsoleApp\ -t consolejson -IncludePackages

does


{
  "Projects": [
    {
      "Id": "ConsoleApp\\ConsoleApp.csproj",
      "Name": "ConsoleApp"
    },
    {
      "Id": "ConsoleApp.Tests\\ConsoleApp.Tests.csproj",
      "Name": "ConsoleApp.Tests"
    }
  ],
  "Packages": [],
  "References": []
}

Access to output path is always forbidden

If I use:
DependenSee "<Inputpath>" "<outputpath>"
in PowerShell, I always get the following Error.

Error:
UnauthorizedAccessException:Access to the path 'D:....' is denied.
at Microsoft.Win32.SafeHandles.SafeFileHandle.CreateFile(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options)

I've tried everything.
with PowerShell with admin privileges:
different output paths
users\documents as output path
different input paths with different projects

I've even build the solution myself with manifest and requestedExecutionLevel level="requireAdministrator"

It seems that i cant get DependenSee to get the privileges to create a file

[FEATURE] IncludePackages should be recursive and package versions should be mentioned as well

Hey there,

To me the most powerful feature of DependenSee is that it can include external Nuget packages.

However, Nuget packages can depend on other packages as well, so it would be nice to see them. Because sometimes those are more important than the topmost packages a given project references. And without that recursiveness the ExcludePackageNamespaces feature doesn't seem very useful to me, tbh.

For example, it could be crucial to show that if your solution depends on Microsoft.Azure.Cosmos, it's going to depend on Newtonsoft.Json as well.

image

And because of various reasons the package versions should be named as well, just as you can see on the image above.

Thanks in advance!

[BUG] -ExcludeFolders switch doesn't handle whitespace correctly.

Reported by Reddit user https://www.reddit.com/r/dotnet/comments/16c0bm9/comment/jzm979e/?context=3


Describe the bug
-ExcludeFolders "A, B" == Folder B doesn't get removed because of the space

To Reproduce
Run DependenSee with command -ExcludeFolders "A, B"
Expected, folder B to be exlcluded
Actual: folder B is included as DependenSee expects the name to include the space. Users must run -ExcludeFolders "A,B" instead (no space)

Example VS Solution

DependenSee Command
DependenSee -ExcludeFolders "A, B"

DependenSee Output
N/A

DependenSee Version
2.2.0

[FEATURE] Show dependent `.dll`s

Is your feature request related to a problem?
No

Describe the solution you'd like
I have some .dlls in a seperate project in my solution. When I reference these .dlls in my .csproj filde dependensee should show them in the dependency graph.

Describe alternatives you've considered
None

Additional context
For example Zenject does not offer a nuget-package so one has to download Zenject as .dlls and reference them in you project themself. DependenSee is not able to detect such a dependency. It looks like this in my .csproj-file:

...
<Reference Include="Zenject, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null">
        <HintPath>..\Zenject\Zenject.dll</HintPath>
</Reference>
...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.