Reputation: 27615
I have just started to use Roslyn, because I would like to develop some static analysis pet projects focused on generating dependency graphs (the output would be .dot files to be compiled to .pdf with Graphviz).
I can see the potential to analyze the code in a per-file basis, but I need the following operations (more or less):
solution.sln
file, find all project.csproj
files referenced by it;project.csproj
file, find all sourcecode.cs
files referenced by it;Specifically, my question is: can I perform operations 1, 2 and 4 with Roslyn, or should I use other tools / techniques instead? Any suggestion?
P.S. I see there is a VisualStudioWorkspace
but I couldn't figure out what I have to do to use it, yet.
Upvotes: 2
Views: 1206
Reputation: 888047
Yes; this is certainly possible.
VisualStudioWorkspace
is used within VS itself; you should only use that from within a VS addin to access the current solution.
To load a solution yourself, use MSBuildWorkspace
.
You will then want to merge symbols from the Compilation
s for each project.
Upvotes: 6