public IProject Create(IProjectInSolution projectInSolution) { var io = _serviceProvider.GetService <ISystemIO>(); var runsettingsFileReader = _serviceProvider.GetService <IRunSettingsFileReader>(); return(new Project(projectInSolution, io, runsettingsFileReader)); }
internal Project(IProjectInSolution projectInSolution, ISystemIO io, IRunSettingsFileReader runSettingsFileReader) { if (projectInSolution == null) { throw new ArgumentNullException(nameof(projectInSolution)); } _io = io ?? throw new ArgumentNullException(nameof(io)); _runSettingsFileReader = runSettingsFileReader ?? throw new ArgumentNullException(nameof(runSettingsFileReader)); _projectFileInfo = new FileInfo(projectInSolution.AbsolutePath); var content = _io.File.ReadAllText(projectInSolution.AbsolutePath); using (var stream = new MemoryStream(Encoding.UTF8.GetBytes(content ?? ""))) using (var reader = XmlReader.Create(stream)) { _evaluatedProject = new Microsoft.Build.Evaluation.Project(reader); } }