Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Accessing VS complete solution in roslyn

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.

like image 336
Harjatin Avatar asked Jun 18 '15 14:06

Harjatin


Video Answer


1 Answers

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.

like image 73
Kevin Pilch Avatar answered Oct 11 '22 19:10

Kevin Pilch