Analyzing Blazor Application
NDepend can analyze Blazor applications. Both Blazor Server App and Blazor WebAssembly App modes are supported.
In the picture below, we can see the panel NDepend > Project properties > Code to Analyze on 2 applications:
- The application BlazorServerApp is a Blazor application based on .NET 5.0 that relies on the Blazor Server App mode.
- The application BlazorWebAssemblyApp is a Blazor application based on .NET 5.0 that relies on the Blazor WebAssembly App mode.
Let's notice that:
- The .NET Profile is .NET 5.0. There is no Blazor specific .NET Profile.
- Directories that contain the ASP.NET 5.0 assemblies are automatically referenced.
- ASP.NET 5.0 referenced assemblies are automatically resolved.
- The runtime net5.0 is shown for all application assemblies.
- Note that if some assemblies are compiled against .NET Standard 2.0 for example, netstandard20 is shown instead.
- Notice that the NDepend default rules take account of Blazor peculiarities and avoid showing false positives on Blazor code.
Comparing Blazor Server App and a Blazor WebAssembly App with NDepend
It is quite interesting and informative to compare a Blazor Server App with a Blazor WebAssembly App. Below see a NDepend dependency graph of both apps.
All other NDepend use-cases work when analyzing Blazor code.
Related Blog Posts
You can refer to these blog posts to see how NDepend can help understanding and analyzing your Blazor applications:
- Blazor Internals you need to know
- Architecture of a C# game rendered with Blazor, Xamarin, UWP, WPF, and Winforms