How can we access the complete visual studio solution from code analyzer in Roslyn
?
I have been trying semantic analysis without much help.
var sol = ((Microsoft.CodeAnalysis.Diagnostics.WorkspaceAnalyzerOptions)context.Options)
.Workspace.CurrentSolution;
This is what I came up with using intellisense but this always gives a null value.
In general, you can't. Analyzers run as part of commandline builds in csc and vbc, which have no notion of Workspaces or Solutions.
We are considering adding a VS specific analyzer API that would allow access to the Solution
, but for Roslyn's 1.0 release, there is no supported way to do so.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With