public static DocumentId AddDocument(this Workspace workspace, ProjectId projectId, IEnumerable<string> folders, string name, SourceText initialText, SourceCodeKind sourceCodeKind = SourceCodeKind.Regular) { var id = projectId.CreateDocumentId(name, folders); var oldSolution = workspace.CurrentSolution; var newSolution = oldSolution.AddDocument(id, name, initialText, folders).GetDocument(id).WithSourceCodeKind(sourceCodeKind).Project.Solution; workspace.TryApplyChanges(newSolution); return id; }
public static DocumentId AddDocument(this Workspace workspace, ProjectId projectId, IEnumerable <string> folders, string name, SourceText initialText, SourceCodeKind sourceCodeKind = SourceCodeKind.Regular) { var id = projectId.CreateDocumentId(name, folders); var oldSolution = workspace.CurrentSolution; var newSolution = oldSolution.AddDocument(id, name, initialText, folders).GetDocument(id).WithSourceCodeKind(sourceCodeKind).Project.Solution; workspace.TryApplyChanges(newSolution); return(id); }