public RoslynSolutionService()
        {
            Workspace = GlobalServices.GetComponentModelService <VisualStudioWorkspace>();
            IEnumerable <KeyValuePair <string, RoslynProject> > projects = from p in Workspace.CurrentSolution.Projects
                                                                           select new KeyValuePair <string, RoslynProject>(p.Name, p);

            projectDictionary = ImmutableDictionary.CreateRange(projects);
            ReferenceService  = new MetadataReferenceService(Workspace);
        }
Esempio n. 2
0
        public static CodeAnalysis.Project GetEquivalent(Project dteproject)
        {
            foreach (CodeAnalysis.Project roslynProject in GlobalServices.GetComponentModelService <VisualStudioWorkspace>().CurrentSolution.Projects)
            {
                if (roslynProject.FilePath.Equals(dteproject.FullName, System.StringComparison.CurrentCultureIgnoreCase))
                {
                    return(roslynProject);
                }
            }

            throw new CouldNotFindEquivalentProjectException(nameof(dteproject));
        }