A prototype of a tool and an extensible API for the visualization of C# codebases.




dotnet tool install --global helveg
To produce a diagram of a codebase, navigate into a directory with a Visual Studio Solution file or a MSBuild C# project file and run:
helveg
Alternatively, to produce a diagram of a solution in C:\dev\my-code\MyCode.sln
, run:
helveg 'C:\dev\my-code\MyCode.sln'
For a complete list of command-line options, see:
helveg --help
Note: If you don't have any C# codebase at hand, run Helveg on itself or on one of the simple samples in the ./samples
directory.
Upon completion, Helveg produces a single .html
file.
This file contains the interactive diagram.
Open it in an up-to-date browser.
For information on how to use the user interface, see supplementary_meterial.pdf
or the Help panel (denoted by an encircled question mark) within the interface itself.
The visualized codebase must be able to build using dotnet build
. Codebases relying on .NET Core and .NET 5+ should be fine. However, you may encounter issues when visualizing projects relying on the old .NET Framework, such as old-style ASP.NET projects and WPF applications.
- .NET 9.0 or newer
- Node 22.4.0 or newer
- an up-to-date web browser
- git (optional)
- Windows 11 or Ubuntu 22.04 or newer
To install Helveg and let it produce a visualization of itself, run the build.sh
command in the repo's root directory. The resulting file will be named index.html
. This script has been tested on Ubuntu 22.04.
To build Helveg from its source code, do the following:
- Make sure you have installed the prerequisites listed above.
- Make sure your computer is connected to the internet.
- Open a command-line or a terminal in the root of the repository.
- Restore .NET tools:
dotnet tool restore
- Enable
corepack
(Node's manager of package managers):corepack enable
- Install the
pnpm
package manager:corepack prepare pnpm@latest --activate
- Install client dependencies:
pnpm install
- Build client scripts:
pnpm run build
- Pack the .NET solution:
dotnet pack Helveg.sln -o artifacts -c Release
- Make sure no prior version of Helveg is installed:
dotnet tool uninstall --global helveg
- Install the newly built Helveg:
dotnet tool install --global --add-source "./artifacts" --version "0.0.0-local" helveg
This repository uses GitVersion to produce NuGet packages with correct semantic version strings.
If you obtained Helveg's code repository without its history (i.e. the .git
folder), you won't be able to use GitVersion and all packages will have the 0.0.0-local
fallback version.
If the .git
directory is present and you have git
installed on your computer, you can generate NuGet packages with correct version strings by following steps 1. - 7. as above and then the following:
- Set the version string in
package.json
files:pnpm run git-version
- Build client scripts:
pnpm run build
- Pack the .NET solution:
dotnet pack Helveg.sln -o artifacts -c Release -p:AllowGitVersion=true
- Make sure no prior version of Helveg is installed:
dotnet tool uninstall --global helveg
- Look into the
./artifacts
directory and make note of<version>
in the filenames. For example inhelveg.42.0.0-answer.nupkg
,<version>
is42.0.0-answer
. - Install the newly built Helveg:
dotnet tool install --global --add-source "./artifacts" --version "<version>" helveg
This software has many dependencies. You do not need to install these explicitly. See Build Instructions above. These are the most significant dependencies:
Back-end
Front-end
Note: It may not be possible to replicate the screenshots exactly due to the interactive nature of the visualization.
To reproduce the screenshots shown above and contained in the screenshots
directory, follow these steps:
helveg_node_with_metadata.png
- Run the command-line tool in the folder with the codebase with these parameters:
- Codebase: https://gitlab.com/helveg/helveg/ (this repo)
- Command:
helveg --preset Docs -p TargetFramework=net8.0 --out-file index.html --mode SingleFile
- The output may differ based on the visualized branch and commit.
- Open the
index.html
file with an up-to-date browser. - In the Appearance panel, disable labels.
- Explore the codebase (expand nodes by double clicking them).
- Adjust the position of the nodes manually (by holding Shift and dragging them).
- Select the
NumericToken
node and open the Properties panel. - The result should look similar to the screenshot.
helveg_with_error.png
- Follow the same instructions as with
helveg_node_with_metadata.png
. However, delete an important type to generate a large number of errors, for example theNumericToken
node. - Open the
index.html
file with an up-to-date browser. - Expand all nodes.
- Zoom in on the nodes with the errors.
- The result should look similar to the screenshot.
kafe_data_types.png
- Run the command-line tool in the folder with the codebase with these parameters:
- Codebase: https://gitlab.fi.muni.cz/legtvar/kafe
- Commit SHA:
52343b6f006b647886c981eb0d7abe57cfc3f0a0
- Command:
helveg --preset Dev -p TargetFramework=net9.0 --out-file index.html -m SingleFile
- Please note that to visualize KAFE, you need to install .NET 9.0.
- Open the
index.html
file with an up-to-date browser. - In the Appearance panel, disable labels.
- In the Quick Start panel, click All types.
- The result should look similar to the screenshot.
kafe_solution.png
- Follow the same instructions as with
kafe_data_types.png
. - Open the
index.html
file with an up-to-date browser. - In the Quick Start panel, click Bird's-eye view.
- Close the Quick Start panel by clicking on its tab again.
- Open the Tree View on the left side of the screen.
- The result should look similar to the screenshot.
- The source code is licensed under the BSD 3-Clause License.
- Icons in
./packages/helveg-diagram/icons/vscode
are from thevscode-codicons
repository, were created by Microsoft, and are licensed under the Creative Commons Attribution 4.0 International Public License. - The ingredients used in the CodePizza feature are based on a number of royalty-free images. A complete list can be found in ~/docs/codepizza.md.