Structurizr.Dgml is a library for converting Structurizr's C4 models to corresponding Dgml graphs.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.



Structurizr.Dgml is a small DotNet library for converting Structurizr's C4 models to corresponding DGML graphs.

Checkout the following for more information:


Below is an example that shows how the Contoso University example has been converted to DGML: Contoso university converted to DGML

In the Visual Studio DGML viewer you can collapse different elements of the model to focus on different aspect of the model:

Partly collapsed version of Contoso university converted to DGML

Using Structurizr.Dgml

Given an C4 model in a Structurizr.Workspace instance, you can simply convert the model to Dgml with the extention method ToDgml(). I.e.,

using OpenSoftware.DgmlTools.Model;
using OpenSoftware.Structurizr.Dgml;
using Structurizr;

namespace MyC4Model
    class Program
        static void Main(string[] args)
            var workspace = new Workspace("My model", "This is an example C4 model.");
            // Fill your model here (see

            // Convert to DGML
            var dgml = workspace.ToDgml();
            // Write to file

You can then open the file c4model.dgml in Visual Studio to view and analyze it. You can find more information about creating a C4 model for dotnet at

More info

Source code of Structurizr.Dgml is available at GitHub. Nuget packages are available at

Structurizr.Dgml is distributed under the Apache 2.0 License.