Skip to main content

RSCG_ExportDiagram by AndreiIgnat

Nuget / site data

Nuget GitHub last commit GitHub Repo stars

Details

Info

info

Name: RSCG_ExportDiagram

Roslyn Diagram generator for external dependencies

Author: AndreiIgnat

NuGet: https://github.com/ignatandrei/RSCG_ExportDiagram

You can find more details at RSCG_ExportDiagram

Source : https://github.com/ignatandrei/RSCG_ExportDiagram

Original Readme

note

RSCG_ExportDiagram

export diagram for external relations for a csproj with other csproj

Install

Add to the csproj


<ItemGroup>
<PackageReference Include="RSCG_ExportDiagram" Version="2024.810.832" OutputItemType="Analyzer" ReferenceOutputAssembly="false" />
</ItemGroup>
<ItemGroup>
<CompilerVisibleProperty Include="RSCG_ExportDiagram_OutputFolder" />
<CompilerVisibleProperty Include="RSCG_ExportDiagram_Exclude" />
</ItemGroup>
<PropertyGroup>
<RSCG_ExportDiagram_OutputFolder>..</RSCG_ExportDiagram_OutputFolder>
<RSCG_ExportDiagram_Exclude></RSCG_ExportDiagram_Exclude>
</PropertyGroup>

And the diagram will be generated in the folder parent for the .csproj file

Alternatively, you can use the command line tool to generate the diagram for a solution


function ProcessCsproj {
param (
[string]$project,
[string]$folderOutput
)

$version = "2024.810.832"
#$folderOutput= ".."
$newNode = [xml]@"
<MainData>
<ItemGroup>
<CompilerVisibleProperty Include="RSCG_ExportDiagram_OutputFolder" />
<CompilerVisibleProperty Include="RSCG_ExportDiagram_Exclude" />
</ItemGroup>

<PropertyGroup>
<RSCG_ExportDiagram_OutputFolder>$folderOutput</RSCG_ExportDiagram_OutputFolder>
<RSCG_ExportDiagram_Exclude></RSCG_ExportDiagram_Exclude>
</PropertyGroup>
</MainData>
"@




# Write-Host $newNode.MainData.InnerXml
$backFile =$project + ".bak"
Copy-Item $project $backFile
dotnet add $project package RSCG_ExportDiagram -v $version

$proj = [xml](Get-Content $project)

$foundNode = $proj.Project
#Write-Host $proj.Project.InnerXml

$ItemGroup = $proj.ImportNode($newNode.DocumentElement.ItemGroup,$true)
$proj.Project.PrependChild($ItemGroup)
$proj.DocumentElement.AppendChild($ItemGroup )


$PropertyGroup = $proj.ImportNode($newNode.DocumentElement.PropertyGroup,$true)
$proj.Project.PrependChild($PropertyGroup)
$proj.DocumentElement.AppendChild($PropertyGroup)
$proj.Save($project)
dotnet build
# pause
Copy-Item $backFile $project -Force
Remove-Item $backFile -Force

}

$solution = gci *.sln | %{ $_.FullName}
$folderSolution = Split-Path $solution
# Write-Host $folderSolution
Get-Content $solution |
Select-String 'Project\(' |
ForEach-Object {
$projectParts = $_ -Split '[,=]' | ForEach-Object { $_.Trim('[ "{}]') };
# New-Object PSObject -Property @{
# Name = $projectParts[1];
# File = $projectParts[2];
# Guid = $projectParts[3]
# }
if ($projectParts[2] -match '.csproj$'){
$fileProject =Join-Path $folderSolution $projectParts[2]
Write-Host $fileProject
ProcessCsproj -project $fileProject -folderOutput $folderSolution
}
}


About

note

Generating diagram for relation classes within referenced project

How to use

Example ( source csproj, source files )

This is the CSharp Project that references RSCG_ExportDiagram

<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="RSCG_ExportDiagram" Version="2024.810.832" OutputItemType="Analyzer" ReferenceOutputAssembly="false" />
</ItemGroup>
<ItemGroup>
<CompilerVisibleProperty Include="RSCG_ExportDiagram_OutputFolder" />
<CompilerVisibleProperty Include="RSCG_ExportDiagram_Exclude" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Person\Person.csproj" />
</ItemGroup>
<PropertyGroup>
<RSCG_ExportDiagram_OutputFolder>obj/GX/</RSCG_ExportDiagram_OutputFolder>
<RSCG_ExportDiagram_Exclude></RSCG_ExportDiagram_Exclude>
</PropertyGroup>
<PropertyGroup>
<EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles>
<CompilerGeneratedFilesOutputPath>$(BaseIntermediateOutputPath)\GX</CompilerGeneratedFilesOutputPath>
</PropertyGroup>
</Project>

Generated Files

Those are taken from $(BaseIntermediateOutputPath)\GX


//JSONFolder=obj/GX/
//projectDir=D:\gth\RSCG_Examples\v2\rscg_examples\RSCG_ExportDiagram\src\DiagramDemoConsole\
//projectName=DiagramDemoConsole
//excludeData=
file class Program_References_1
{
public Program_References_1()
{


// Method Main has following external references
// Person.PersonData..ctor
//Person.PersonData.Name

}
}

Usefull

Download Example (.NET C# )

Share RSCG_ExportDiagram

https://ignatandrei.github.io/RSCG_Examples/v2/docs/RSCG_ExportDiagram

In the same category (EnhancementProject) - 18 other generators

AutoInvoke.Generator

AutoSpectre

BuildInfo

Com

CommandLine

DeeDee

LinqGen.Generator

Mediator

Pekspro.BuildInformationGenerator

PlantUmlClassDiagramGenerator

RSCG_AMS

RSCG_FunctionsWithDI

RSCG_NameGenerator

RSCG_TimeBombComment

RSCG_Wait

ThisAssembly

ThisAssembly.Constants

ThisAssembly.Metadata