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;
 }
Beispiel #2
0
        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);
        }