0

I would like to dump the structure of my C# solution to a text file or some other output available.

In a solution I have 72 projects and I would like to dump this structure in a fashion similar to the following:


  • Namespace
    • Classes
      • Methods
        • Call hierarchy (the fully qualified caller that invokes said method)

The structure does not have to look exactly like this. As long as I can have some way of determining how what interacts with each other and the fully qualified names of all the projects and classes that exist in a said solution.

The reason for wanting this is so that I can have the current structure documented (even if it is not fully documented) before I can start extracting the different projects in to relative solutions.

Servy
  • 202,030
  • 26
  • 332
  • 449
JDProwler
  • 109
  • 1
  • 1
  • 8
  • https://stackoverflow.com/questions/15316381/create-html-documentation-for-c-sharp-code – Y.S Aug 20 '18 at 12:40
  • This is unfortunately not a way to go as the company doesn't have any coding standards etc in place so the different developers over the years just slapped stuff together with little or no comments – JDProwler Aug 20 '18 at 13:00
  • sand castle mentioned in the link, will generate an html documentation with call hierarchy just like you need, and it's easy and simple to integrate with. If you got XML comments, that's a bonus. I'm afraid to say that the answer you accepted is not a solution... sln files just contain build related info and dll dependency, not class / method / namespace correlation.. best of luck – Y.S Aug 20 '18 at 13:02
  • Cool. I put in your answer there, but feel free to answer it again so that I can mark it and get you some rep – JDProwler Aug 20 '18 at 13:23
  • thanks no need, it was more a reference then an actual answer, there are plenty of tools out providing you with what you need including plugins to visual studio by the way. hope you find the right one – Y.S Aug 20 '18 at 13:26
  • This one was quite useful enough thanks. – JDProwler Aug 27 '18 at 13:05

2 Answers2

0

.sln and .csproj files are clear text - I suspect you could just:
1. Open the .sln file
2. Read and parse all Project - EndProject sections (get the .csproj relative
location)
3. Open each .csproj file (XML)
4. Select all ItemGroup tags
5. Content / Compile sub-tags, read Include attriubte for file name

Hope this is useful, S

JustAShai
  • 39
  • 1
  • Hi, thanks it does a bit. I know and understand that the files are clear text but I was looking more for a VS built in function instead of wasting development time for such a simple task. – JDProwler Aug 20 '18 at 12:58
  • Ah well I'm not sure there's a tool for that, you could theoretically use Roslyn (Microsoft.CodeAnalysis) to figure out everything except the call hierarchy. – JustAShai Aug 21 '18 at 17:02
0

Answer as per Y.S in comments:

See Sandcastle Help File Builder on GitHub as well as the related post on SO here.

Thanks again for the better solution to my dilemma @Y.S

JDProwler
  • 109
  • 1
  • 1
  • 8