I am using the following code to open solution, load the project and create the compilation.
var solution = await workspace.OpenSolutionAsync(solutionPath, new ConsoleProgressReporter());
Project valueObjectProject = solution.Projects.FirstOrDefault(proj => String.Equals(proj.Name,
"ValueObject", StringComparison.CurrentCultureIgnoreCase));
var bofCompilation = await valueObjectProject.GetCompilationAsync();
Issue: no of items in valueObjectProject.ProjectReferences
and compilation.References
is 0, which is not true. The property should show a list of projects on which the ValueObject
project depends upon. But, I am getting list of all the microsoft assemblies which the project uses under valueObject.MetadataReferences
and compilation.ExternalReferences
Currently, the Diagnostics shows multiple errors of type TypeNotFound because the referenced types are declared in different assemblies. I think this is because the compilation does not have project dependency information. Don't know what is going wrong.
any help would be highly appreciated.