public override void Parse() { var _project = msbuildWorkspace.OpenProjectAsync(Path).Result; _project = (_project.ProjectReferences.Count() != 0) ? _project.AddMetadataReferences(Util.GetGlobalReferences()) : _project; Solution = _project.Solution; TopologicallySortedProjectDependencies.Add(_project); }
public override void Parse() { var projectId = ProjectId.CreateNewId(); var docId = DocumentId.CreateNewId(projectId); Solution = msbuildWorkspace.CurrentSolution; string fileName = System.IO.Path.GetFileNameWithoutExtension(Path); Solution = Solution.AddProject( projectId, fileName, fileName + ".dll", LanguageNames.CSharp ); Solution = Solution.AddDocument( docId, fileName, SourceText. From(File.ReadAllText(Path), new UTF8Encoding(false)), new[] { System.IO.Path.GetDirectoryName(Path) }, Path ); Solution = Solution.WithProjectFilePath(projectId, System.IO.Path.GetDirectoryName(Path)); Solution = Solution.WithProjectCompilationOptions(projectId, new CSharpCompilationOptions( OutputKind.DynamicallyLinkedLibrary, optimizationLevel: OptimizationLevel.Debug, platform: Platform.X64 ) ); Solution = Solution.WithProjectOutputFilePath( projectId, System.IO.Path.Combine(System.IO.Path.GetDirectoryName(Path), fileName + ".dll") ); Solution = Solution.AddMetadataReferences(projectId, Util.GetGlobalReferences()); TopologicallySortedProjectDependencies.AddRange(Solution.Projects); }