2

I load my solution:

var workspace = Workspace.LoadSolution(path);

Now I would like create a semantic model with any file in this solution. How Can I do this? I tried used LINQ but I don't now how create a semantic model to analysis classdeclaration, etc.

ISolution semanticModel = tree.GetSemanticModel();

not work ;(

1 Answer 1

3

You can get the semantic model from a document instance.

var someSemanticModel = 
    workspace.CurrentSolution
             .Projects.First()
             .Documents.First()
             .GetSemanticModel();
Sign up to request clarification or add additional context in comments.

2 Comments

doing this I get an error when trying to resolv that belongs to a AST that's different from the current document. It's seems the semantic model is related to the document and not the solution
The semantic model relates to a syntax tree, which typically relates to a single document

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.